You might be able to use a WHERE statement in a procedure
in order to perform the same task as a DATA step with a subsetting
IF statement. The WHERE statement can eliminate extra DATA step processing
when performing certain analyses because unneeded observations are
not processed.
For example, the following
DATA step creates a data set SEATBELT, which contains only those observations
from the AUTO.SURVEY data set for which the value of SEATBELT is YES.
The new data set is then printed.
libname auto '/users/autodata';
data seatbelt;
set auto.survey;
if seatbelt='yes';
run;
proc print data=seatbelt;
run;
However, you can get
the same output from the PROC PRINT step without creating a data set
if you use a WHERE statement in the PRINT procedure, as in the following
example:
proc print data=auto.survey;
where seatbelt='yes';
run;
The WHERE statement can save resources by eliminating
the number of times that you process the data. In this example, you
might be able to use less time and memory by eliminating the DATA
step. Also, you use less I/O because there is no intermediate data
set. Note that you cannot use a WHERE statement in a DATA step that
reads raw data.