Chapter Contents |
Previous |
Next |
FETCH |
Category: | SAS Table |
Syntax | |
Details | |
Example | |
See Also |
Syntax |
sysrc=FETCH(table-id<,'NOSET'>); |
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
'NOSET'
Type: Numeric
Details |
FETCH skips rows that have been marked for deletion. When a WHERE clause is active, the function reads the next row that meets the WHERE condition.
If the SET routine 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). To temporarily override this behavior so that fetched values are not automatically copied to the SDV, use the NOSET option.
Example |
Fetch the next row from the SAS table MYDATA. If the end of the table is reached or if an error occurs, SYSMSG retrieves the appropriate message and displays it on the message line.
INIT: tableid=open('mydata','i'); return; MAIN: rc=fetch(tableid); if rc then _msg_=sysmsg(); else do; ...more SCL statements... end; return; TERM: rc=close(tableid); return;
See Also |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.