Previous PageNext Page

Differences between subsetting IF and WHERE
The differences are these:

The WHERE statement checks whether its expression is true before the observation is brought into the data step whereas
the subsetting IF checks its expression after bringing in an observations.

A WHERE statement is usually more efficient than a subsetting IF since less input processing can occur.

The subsetting IF is legal only in the data step.
The WHERE statement is also permitted in Proc steps. If the WHERE is used in a data step, the step must be creating a new data set from existing SAS dataset(s).

Any arbitrarily complex expression may be used in an IF statement expression but,
in the WHERE statement, a restricted set of operators and only the variables in the input data set are allowed.

Previous PageTable Of ContentsNext Page