Lesson 1: how to create a data table

*Email 1 of the “Ace the SAS Base Programmer Exam” training series

Hi folks, welcome to our “Ace the SAS Base Programmer exam” series. This program was developed to help busy professionals and students learn SAS painlessly. Each day, you will receive a practice SAS lesson focusing on one concept or a question that will test and expand your knowledge of the SAS programming language so you can pass the exam, learn how to use SAS to get more stuff done, and land that dream job of yours or score that big promotion. You’ve taken the first step by signing -up, now get ready to see some results!

Today’s lesson covers how to manually create a data set where you enter in the values yourself instead of importing data from an external data source like an excel file (we’ll cover that later).

Quick note: you can add comments to your code by opening and closing your comment with a slash and asterix, like so:

/*This is a comment*/

You can create a table using the following syntax:

DATA myTable
INPUT var1 $ var2;
Laura 99
John 57
Shelly 75

The first line tells SAS to create a new table and call it whatever you want, so long as it’s under 32 characters and doesn’t start with a number. The INPUT statement is where you list the column names for your table. Adding the $ sign after the variable instructs SAS that the variable is character, not numerical. Finally, you type in the values for each row separated by a space. And Voila! You’ve created a SAS table which you can now use for your analysis.

Tomorrow, we’ll test you on what we covered today and introduce some new concepts. Stay tuned!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s