Previous Page | Next Page

Functions and CALL Routines

CALL VNAME Routine



Assigns a variable name as the value of a specified variable.
Category: Variable Control

Syntax
Arguments
Details
Examples
See Also

Syntax

CALL VNAME(variable-1,variable-2);

Arguments

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.


Details

The CALL VNAME routine assigns the name of the variable-1 variable as the value of the variable-2 variable.


Examples

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;


See Also

Functions:

VNAME Function

VNAMEX Function

Previous Page | Next Page | Top of Page