Previous Page | Next Page

SAS Component Language Dictionary

VARNAME



Returns the name of a SAS table column
Category: Variable

Syntax
Example
See Also

Syntax

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

var-name

contains the name of the column.

Type: Character

table-id

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

Type: Numeric

var-num

is the number of the column in the SAS table. This is the number that is adjacent to the column in the list that is produced by the CONTENTS procedure. The VARNUM function returns this number.

Type: Numeric


Example

Copy the names of the first five columns in the SAS table CITY into an SCL variable. The column names are separated by blanks.

length varlist $ 80;

tableid=open('city','i');
varlist=' ';
do i=1 to min(5,attrn(tableid,'nvars'));
   j=9*(i-1)+1;
   substr(varlist,j,8)=varname(tableid,i);
end;
put varlist=;
rc=close(tableid);


See Also

VARNUM

Previous Page | Next Page | Top of Page