SAS Component Language Dictionary |
Category: | SAS Table |
Syntax | |
Details | |
Examples | |
Example 1: Using GETVARN to Search for a Value | |
Example 2: Using GETVARC with a Nested VARNUM | |
See Also |
Syntax |
cval=GETVARC(table-id,col-num); |
nval=GETVARN(table-id,col-num); |
is the value of the character column that is returned by GETVARC.
is the identifier for a table that is open. If table-id is invalid, the program halts.
is the number of the column in the Table Data Vector (TDV). This value can be obtained by using the VARNUM function. If the column specified in col-num is invalid, the program halts.
is the value of the numeric column that is returned by GETVARN.
Details |
Before you use GETVARC or GETVARN, you can use VARNUM to obtain the number of a column in a SAS table. You can nest VARNUM, or you can assign it to a column that can be passed as the second argument. GETVARC and GETVARN read the value of the specified column that is in the current row in the TDV and copy that value to the specified SCL variable in the SCL data vector (SDV).
Examples |
Assign VARNUM to a column that can be passed as the second argument to GETVARN. Read row number 10 into the TDV.
pricenum=varnum(mydataid,'price'); rc=fetchobs(mydataid,10); price=getvarn(mydataid,pricenum);
Nest VARNUM in the GETVARC function to search for the value of the character column NAME from the tenth row of the open SAS table whose identifier is stored in the column MYDATAID.
rc=fetchobs(mydataid,10); user=getvarc(mydataid,varnum(mydataid,'name'));
See Also |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.