Automatic macro variables are stored in the global symbol table. User-defined macro variables that you create with a %LET statement in open code (code that is outside of a macro definition) are also stored in the global symbol table.
The global symbol table is created during the initialization of a SAS session and is deleted at the end of the session. Macro variables in the global symbol table
Are available anytime during the session can be created by a user have values that can be changed during the session (except for some automatic macro variables).
You can create a global macro variable with a %LET statement (used outside a macro definition) a DATA step that contains a SYMPUT routine a SELECT statement that contains an INTO clause in PROC SQL a %GLOBAL statement. You should already be familiar with the %LET statement, the SYMPUT routine and the INTO clause. Let's take a closer look at using the %GLOBAL statement.
Multiple Local Symbol Tables
Multiple local symbol tables can exist concurrently during macro execution if you have nested macros. That is, if you define a macro program that calls another macro program, and if both macros create local symbol tables, then two local symbol tables will exist while the second macro executes.
Suppose the following two macros, Outer and Inner, have been compiled. The macro named Outer creates a local macro variable named variX and assigns a value of one to it. Then Outer calls another macro program named Inner. The macro named Inner creates a local macro variable named variY and assigns the value of variX to it.
%macro outer; %local variX; %let variX=one; %inner %mend outer; %macro inner; %local variY; %let variY=&variX; %mend inner;
Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!