SAS Component Language Dictionary |
Category: | Variable |
Syntax | |
Details | |
Example | |
See Also |
Syntax |
var-num=VARNUM(table-id,var-name); |
contains the position number of the column in the SAS table, or 0 if the column is not in the SAS table.
is the identifier that was assigned when the table was opened. If table-id is invalid, the program halts.
Details |
VARNUM returns the number of a SAS table column.
Example |
Obtain the number of a column in the SAS table MYDATA, using the value of the NAME variable:
tableid=open('mydata','i'); if (sasname(name)) then do; citynum=varnum(tableid,name); if (citynum=0) then _msg_='The column is not in the table.'; else _msg_='The column number is '|| citynum; end; else _msg_='Invalid SAS name--please reenter.';
See Also |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.