Previous PageNext Page

Use of the Where statement
There is even another alternative to the subsetting IF or IF-THEN DELETE methods for forming a subset.

Data Males;
     Set library.Survey12;
     WHERE Gender='M';

The WHERE statement appears nearly identical in syntax to a subsetting IF, in that the keyword appears to be the only difference. The effect in this case is identical, a subset data file is created.

WHERE statement (data step and Proc steps that read a data set)
WHERE where-expression;

The Where statement acts like a gate, controlling whether an observation in a data set (on disk) enters the program data vector data step (in RAM). The WHERE specifies a condition that must occur before SAS brings in the observation. One of two things occur:

For more information, see SL:R, Chapter 9 SAS Language statements, WHERE.

Previous PageTable Of ContentsNext Page