• Beginning with SAS Version 8, if CALL SYMPUT is used after a PROC SQL,
the variable will be created in a local symbol table.
• If the macro variable SYSPBUFF is created at macro invocation time, the
variable will be created in the local symbol table.
• If the executing macro contains a computed %GOTO statement, the variable will
be created in the local symbol table. A computed %GOTO statement is one that
uses a label that contains an & or a % in it. That is, a computed %GOTO
statement contains a macro variable reference or a macro call that produces a text
expression. Here is an example of a computed %GOTO statement:
The symbol table that is currently available to a DATA step is the one that exists when
SAS determines that the step is complete. (SAS considers a DATA step to be complete
when it encounters a RUN statement, a semicolon after data lines, or the beginning of
If an executing macro contains a computed %GOTO statement, or if the macro variable
SYSPBUFF is created at macro invocation time, but the local symbol table is empty,
CALL SYMPUT behaves as if the local symbol table was not empty, and creates a local
You might find it helpful to use the %PUT statement with the _USER_ option to
determine what symbol table the CALL SYMPUT routine has created the variable in.
Example Using CALL SYMPUT with Complete DATA Step and a
Nonempty Local Symbol Table
Consider the following example, which contains a complete DATA step with a CALL
SYMPUT statement inside a macro:
x = 'a token';
y = "&myvar1";
When you submit these statements, you receive an error message:
WARNING: Apparent symbolic reference MYVAR1 not resolved.
This message appears for the following reasons:
• the DATA step is complete within the environment of ENV1 (that is, the RUN
statement is within the macro)
• the local symbol table of ENV1 is not empty (it contains parameter PARAM1)
Therefore, the CALL SYMPUT routine creates MYVAR1 as a local variable for ENV1,
and the value is not available to the subsequent DATA step, which expects a global
66 Chapter 5 • Scopes of Macro Variables