Reads a specified observation from a SAS data set into the Data Set Data Vector (DDV).
Category: | SAS File I/O |
is a numeric variable that specifies the data set identifier that is returned by the OPEN function.
is a numeric constant, variable, or expression that specifies the number of the observation to read. FETCHOBS treats the observation value as a relative observation number unless you specify the ABS option. The relative observation number might not coincide with the physical observation number on disk, because the function skips observations marked for deletion. When a WHERE clause is active, the function counts only observations that meet the WHERE condition.
Default | FETCHOBS skips deleted observations. |
is a character constant, variable, or expression that names one or more options, separated by blanks:
ABS | specifies that the value of obs-number is absolute. That is, deleted observations are counted. |
NOSET | prevents the automatic passing of SAS data set variable values to DATA step or macro variables even if the SET routine has been called. |
%let rc = %sysfunc(fetchobs(&mydataid,10)); %if &rc = −1 %then %put End of data set has been reached.; %if &rc > 0 %then %put %sysfunc(sysmsg());