CALL SYMPUTN Routine

In SCL programs, assigns a numeric value to a global macro variable.
Type: SCL call routine
See: SYMGET Function, SYMGETN Function, and CALL SYMPUT Routine

Syntax

CALL SYMPUTN('macro-variable', value);

Required Arguments

macro-variable
is the name of a global macro variable with no ampersand – note the single quotation marks. Or, it is the name of an SCL variable that contains the name of a global macro variable.
value
is the numeric value to assign, which can be a number or the name of a numeric SCL variable.

Details

The SYMPUTN routine assigns a numeric value to a global SAS macro variable. SYMPUTN assigns the value when the SCL program executes. You can also use SYMPUTN to assign the value of a macro variable whose name is stored in an SCL variable. For example, to assign the value of SCL variable UNITNUM to SCL variable UNITVAR, which contains 'UNIT', submit the following:
call symputn(unitvar,unitnum)
You must use SYMPUTN with a CALL statement.
Note: It is inefficient to use an ampersand (&) to reference a macro variable that was created with CALL SYMPUTN. Instead, use SYMGETN. It is also inefficient to use CALL SYMPUTN to store a variable that does not contain a numeric value.

Comparisons

  • SYMPUTN assigns numeric values, but SYMPUT assigns character values.
  • SYMPUTN is available only in SCL programs, but SYMPUT is available in DATA step programs and SCL programs.
  • SYMPUTN assigns numeric values, but SYMGETN retrieves numeric values.

Example: Storing the Value 1000 in the Macro Variable UNIT When the SCL Program Executes

This statement stores the value 1000 in the macro variable UNIT when the SCL program executes:
call symputn('unit',1000);