Using WHERE in Proc statements
If all you want to do is print out data for the males, don't create a subset in the data step and then print the subset. Print the subset directly.
Proc Print Data=library.Survey12; WHERE Gender='M'; Title 'Like Example 1.2 in C&P Chapter 3'; run;
Notice that there is no ID statement in the Proc Print. The observation numbers in the original data set are printed in the OBS column.
Like Example 1.2 in C&P Chapter 3 OBS SUBJ GENDER HEIGHT WEIGHT YEAR 1 1 M 68 155 91 3 9 M 66 120 93 5 8 M 250 70 91
IF the ID Subj; statement had been used, the output would have been identical to that seen in the previous example.