Previous Page | Next Page

SAS Component Language Dictionary

VARNUM



Returns the number of a SAS table column
Category: Variable

Syntax
Details
Example
See Also

Syntax

var-num=VARNUM(table-id,var-name);

var-num

contains the position number of the column in the SAS table, or 0 if the column is not in the SAS table.

Type: Numeric

table-id

is the identifier that was assigned when the table was opened. If table-id is invalid, the program halts.

Type: Numeric

var-name

is the name of the column.

Type: Character


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

VARNAME

Previous Page | Next Page | Top of Page