26 Handbook of SAS
®
DATA Step Programming
a data set by reading the variables ID, SMOKE, and AGE from the HEARING
data set. Using the KEEP= option after DAT1 in the DATA statement will
yield thesame result; however, specifying the KEEP= option in the SET state-
ment in this example is more efcient because SAS reads only the desired
variables.
Program 1.11:
data dat1;
set hearing(keep = id smoke age);
run;
The easiest way to verify whether the DAT1 data set was created cor-
rectly is to check your SAS log. Based on the SAS log from Program 1.11,
you cansee that DAT1 contains 34 observations and 3 variables. You can
also use PROC CONTENTS to examine the contents of the newly created
dataset.
Log from Program 1.11:
136 data dat1(keep = id smoke age); ...