SAS Component Language Dictionary |
Assign the value of a SAS table column to an SCL variable
cval=GETVARC(table-id,col-num);
|
nval=GETVARN(table-id,col-num);
|
-
cval
-
is the value of the character column
that is returned by GETVARC.
Type: Character
-
table-id
-
is the identifier for a table that
is open. If table-id is invalid, the program
halts.
Type: Numeric
-
col-num
-
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.
Type: Numeric
-
nval
-
is the value of the numeric column
that is returned by GETVARN.
Type: Numeric
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).
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'));
FETCH
FETCHOBS
LOCATEC and LOCATEN
PUTVARC and PUTVARN
UPDATE
VARNUM
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.