Previous Page | Next Page

SAS Component Language Dictionary

VARTYPE



Returns the data type of a SAS table column
Category: Variable

Syntax
Example
See Also

Syntax

type=VARTYPE(table-id,var-num);

type

contains the data type of the column:

C

character column

N

numeric 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 position 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. VARNUM function returns this number.

Type: Numeric


Example

Place the first five numeric columns of the SAS table MYDATA into an SCL variable:

length varlist $ 44;
dsid=open('mydata','i');
varlist=' ';
j=0;
do i=1 to nvar(dsid) while (j<5);
if (vartype(dsid,i)='N') then
   do;
      varlist=varlist||' '||varname(dsid,i);
      j+1;
   end;
end;
rc=close(dsid);


See Also

MODVAR

VARNUM

Previous Page | Next Page | Top of Page