DATA Step Call Routines for Macros |
Type: | SCL call routine | |||
See also: |
|
Syntax | |
Details | |
Comparisons | |
Example | |
Storing the Value 1000 in The Macro Variable UNIT When the SCL Program Executes |
Syntax |
CALL SYMPUTN('macro-variable', value); |
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.
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 |
This statement stores the value 1000 in the macro variable UNIT when the SCL program executes:
call symputn('unit',1000);
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.