CALL SYMPUTX

 

CALL SYMPUTX provides two functions:

-automatically left justifies and trims the trailing blanks from a numeric value.

-provides the ability to specify the scope of the  variable.

 

 

Syntax

 

CALL SYMPUTX(macro-variable, value <,symbol-table>);

Arguments

macro-variable

can be one of the following:

·         a character string that is a SAS name, enclosed in quotation marks.

·         the name of a character variable whose values are SAS names.

·         a character expression that produces a macro variable name. This form is useful for creating a series of macro variables.

a character constant, variable, or expression. Leading and trailing blanks are removed from the value of name, and the result is then used as the name of the macro variable.

value

specifies a character or numeric constant, variable, or expression. If value is numeric, SAS converts the value to a character string using the BEST. format and does not issue a note to the SAS log. Leading and trailing blanks are removed, and the resulting character string is assigned to the macro variable.

symbol-table

specifies a character constant, variable, or expression. The value of symbol-table is not case sensitive. The first non-blank character in symbol-table specifies the symbol table in which to store the macro variable. The following values are valid as the first non-blank character in symbol-table:

G

specifies that the macro variable is stored in the global symbol table, even if the local symbol table exists.

L

specifies that the macro variable is stored in the most local symbol table that exists, which might be the global symbol table.

F

specifies that if the macro variable exists in any symbol table, CALL SYMPUTX uses the version in the most local symbol table in which it exists. If the macro variable does not exist, CALL SYMPUTX stores the variable in the most local symbol table.

Note:   If you omit symbol-table, or if symbol-table is blank, CALL SYMPUTX stores the macro variable in the same symbol table as does the CALL SYMPUT routine.    [cautionend]


Comparisons

CALL SYMPUTX is similar to CALL SYMPUT except that


Examples

The following example shows the results of using CALL SYMPUTX.

data _null_;
   call symputx('  items  ', '   leading and trailing blanks removed   ',
                'lplace');
   call symputx('  x   ', 123.456);
run;
 
%put items=!&items!;
%put x=!&x!;

The following lines are written to the SAS log:

   ----+----1----+----2----+----3----+----4----+----5
   items=!leading and trailing blanks removed!
   x=!123.456!