When you conditionally select a subset of observations
with a WHERE expression, you can also segment that subset by applying
FIRSTOBS=, OBS=, or both processing (as data set options and system options).
When used with a WHERE expression,
-
FIRSTOBS= specifies the observation
number within the subset of data selected by the WHERE expression
to begin processing.
-
OBS= specifies when to stop processing
observations from the subset of data selected by the WHERE expression.
When used with a WHERE
expression, the values specified for OBS= and FIRSTOBS= are not the
physical observation number in the data set, but a logical number
in the subset. For example,
obs=3
does
not mean the third observation number in the data set. Instead, it
means the third observation in the subset of data selected by the
WHERE expression.
Applying OBS= and FIRSTOBS=
processing to a subset of data is supported for the WHERE statement,
WHERE= data set option, and WHERE clause in the SQL procedure.
If you are processing
a SAS view that is a view of another view (nested views), applying
OBS= and FIRSTOBS= to a subset of data could produce unexpected results.
For nested views, OBS= and FIRSTOBS= processing is applied to each
SAS view, starting with the root (lowest-level) view, and then filtering
observations for each SAS view. The result could be that no observations
meet the subset and segment criteria.
See
Processing a SAS View.