SAS Component Language Dictionary |
Category: | SAS Table |
Syntax | |
Details | |
Example | |
See Also |
Syntax |
sysrc=FETCH(table-id<,'NOSET'>); |
contains the return code for the operation:
0 | |
>0 | |
<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 |
is the identifier that was assigned when the table was opened. If table-id is invalid, the program halts.
prevents the automatic passing of SAS table column values to SCL variables even if the SET routine has been called.
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 |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.