Add-Innovation Home

About Add-Innovation

Contact Us

  SAS Institute logo.    When testing code use OBS= and FIRSTOBS=

This suggestion is probably already in use. If not, the number of observations to be processed can be limited by using the OBS and FIRSTOBS options. The FIRSTOBS= option specifies the number of the first observation to process while the OBS= option specifies the number of the last observation. Both options can either be applied as a dataset option (e.g. SET ABC(FIRSTOBS=5 OBS=10);) or on a SAS Options statement which applies to all subsequent statements (e.g. OPTIONS FIRSTOBS=5 OBS=10;).
Note however, that the OBS and FIRSTOBS options cannot be used with the WHERE option.
The FIRSTOBS= option can be useful when reading files that contain header records, and is more efficient than using the subsetting IF statement “IF _N_ ne 1;”.