Chapter Contents |
Previous |
Next |
FETCHOBS |
Category: | SAS Table |
Syntax | |
Details | |
Example | |
See Also |
Syntax |
sysrc=FETCHOBS(table-id,row-number<,options>); |
0 | successful |
>0 | not successful |
<0 | the operation was completed, but
a warning or a note was generated. If the row is locked, it is
still fetched (read in) but a sysrc of _SWNOUPD is returned. |
-1 | the end of the table was reached |
Type: Numeric
Type: Numeric
Type: Numeric
'ABS'
'NOSET'
Type: Character
Details |
If SET has previously been called, the values for any table columns that are also window variables or SCL variables for the application are automatically passed from the TDV to the SCL Data Vector (SDV) with FETCHOBS. You can use NOSET in the FETCHOBS function to temporarily override this behavior so that fetched values are not automatically copied to the SDV. FETCHOBS treats the row value as a relative row number unless the ABS option is specified.
The row value may or may not coincide with the physical row number on disk. For example, the function skips rows that have been marked for deletion. When a WHERE clause is active, the function counts only rows that meet the WHERE condition. If row-number is less than 0, the function returns an error condition. If row-number is greater than the number of rows in the SAS table, an 'End of file' warning is returned.
Example |
Fetch the tenth row from the SAS table MYDATA. If the end of the table is reached, a message to that effect is displayed on the message line. If an error occurs, the SYSMSG function retrieves the error message and displays it on the message line.
rc=fetchobs(mydata,10); if (rc=-1) then _msg_='End of table has been reached.'; if (rc ne 0) then _msg_=sysmsg();
See Also |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.