Lesson 2: variable informat

This is the 2nd e-mail of the “Ace the SAS Base Programmer Exam” training series

Informats tell SAS how to read variables. Remember the table we created last week? The dollar sign after the “var1” variable is an example of an informat, it tells SAS to read in that variable as a character variable and not a numeric, which is the default way SAS reads variables where the informat is not specified.

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

What do you think the output of the code below would be, given that we’ve forgotten to use the $ sign for the variable “Names”?

DATA myTable2
INPUT Names Age;
Jess 23

a) Jess 23
b) . 23

Answer: b

Since no informat was specified, SAS tried to read in “Jess” as a numeric variable which obviously doesn’t work. Because it could not read it, it saved it as null, or missing, which is denoted by a dot in SAS.


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