Previous Page | Next Page

Functions and CALL Routines

CALL LABEL Routine



Assigns a variable label to a specified character variable.
Category: Variable Control

Syntax
Arguments
Details
Examples
See Also

Syntax

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

Arguments

variable-1

specifies any SAS variable. If variable-1 does not have a label, the variable name is assigned as the value of variable-2.

variable-2

specifies any SAS character variable. Variable labels can be up to 256 characters long. Therefore, the length of variable-2 should be at least 256 characters to avoid truncating variable labels.

Note:   To conserve space, you should set the length of variable-2 to the length of the label for variable-1, if it is known.  [cautionend]


Details

The CALL LABEL routine assigns the label of the variable-1 variable to the character variable variable-2.


Examples

This example uses the CALL LABEL routine with array references to assign the labels of all variables in the data set OLD as values of the variable LAB in data set NEW:

data new;
   set old;
      /* lab is not in either array */ 
   length lab $256;        
      /* all character variables in old */ 
   array abc{*} _character_;  
      /* all numeric variables in old */ 
   array def{*} _numeric_;     
   do i=1 to dim(abc);
         /* get label of character variable */ 
      call label(abc{i},lab); 
         /* write label to an observation */ 
      output;                 
   end;
   do j=1 to dim(def);
         /* get label of numeric variable */ 
      call label(def{j},lab); 
         /* write label to an observation */ 
      output;                 
   end;
   stop;
   keep lab;
run;


See Also

Function:

VLABEL Function

Previous Page | Next Page | Top of Page