Lesson 1.2: Multiple Variables?
More often than not, we want the dataset to include more than 1 variable. We can use the ‘input’ and ‘datalines’ statements to create it:
This example illustrates how to create a dataset with more than 1 variable:
INPUT name $ dept $;
Let’s break down the codes above.
(1) The INPUT statement assigns names to the two variables created. The first variable is called ‘name’ and the second one is called ‘dept’.
(2) The DATALINES statement tells SAS the next line of codes should be read in as data as opposed to the programming codes.
(3) These are the data that are to be read in.
Now, let’s take a look at the dataset that we have just created:
DONE! You have learned to check programming errors in SAS.