Previous Page | Next Page

DATA Step Call Routines for Macros

CALL SYMPUTN Routine



In SCL programs, assigns a numeric value to a global macro variable.
Type: SCL call routine
See also:

SYMGET Function

SYMGETN Function

CALL SYMPUT Routine


Syntax
Details
Comparisons
Example
Storing the Value 1000 in The Macro Variable UNIT When the SCL Program Executes

Syntax

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

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.  [cautionend]


Comparisons


Example


Example 1: 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);

Previous Page | Next Page | Top of Page