Functions and CALL Routines |
Assigns a variable name as the value of a specified variable.
Category: |
Variable Control
|
CALL VNAME(variable-1,variable-2);
|
-
variable-1
-
specifies any SAS variable.
-
variable-2
-
specifies any SAS character variable. Because
SAS variable names can contain up to 32 characters, the length of variable-2 should be at least
32.
The CALL VNAME routine assigns the name
of the variable-1 variable as the value of the variable-2 variable.
This example uses the CALL VNAME routine with array
references to return the names of all variables in the data set OLD:
data new(keep=name);
set old;
/* all character variables in old */
array abc{*} _character_;
/* all numeric variables in old */
array def{*} _numeric_;
/* name is not in either array */
length name $32;
do i=1 to dim(abc);
/* get name of character variable */
call vname(abc{i},name);
/* write name to an observation */
output;
end;
do j=1 to dim(def);
/* get name of numeric variable */
call vname(def{j},name);
/* write name to an observation */
output;
end;
stop;
run;
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.