Chapter Contents |
Previous |
Next |
GETVARC and GETVARN |
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); |
Type: Character
Type: Numeric
Type: Numeric
Type: Numeric
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 |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.