If you process fewer
observations and variables, SAS performs fewer I/O operations. To
limit the number of observations that are processed, you can use the
subsetting IF statement and the WHERE statement. Best programming
practices can be applied if you understand other differences between
subsetting IF and WHERE statements. You can also improve performance
by applying OBS= and FIRSTOBS= processing with a WHERE statement.
To select observations
when reading data from external files, position a subsetting IF statement
in a DATA step so that it reads only the variables that are needed
to select the subset before reading all the data. This can reduce
the overhead required to process data.
To limit the number
of variables that are processed, you can use either of the following:
-
the DROP and KEEP statements
-
the DROP= and KEEP= data set options.
In
the SET statement, the DROP= or KEEP= data set option controls which
variables are read and subsequently processed. In the DATA statement,
the DROP= or KEEP= data set option controls which variables are written
to an output data set after processing. Using the SET statement with
these options is the most efficient and best practice.