Chapter Contents |
Previous |
Next |
SAS Macro Language: Reference |
Global Macro Variables illustrates the global symbol table during execution of the following program:
%let county=Clark; %macro concat; data _null_; length longname $20; longname="&county"||" County"; put longname; run; %mend concat; %concat
Calling the macro CONCAT produces the following statements:
data _null_; length longname $20; longname="Clark"||" County"; put longname; run;
The PUT statement writes the following to the SAS log:
Clark County
Global macro variables include the following:
You can create global macro variables any time during a SAS session or job. Except for some automatic macro variables, you can change the values of global macro variables any time during a SAS session or job.
In most cases, once you define a global macro variable, its value is available to you anywhere in the SAS session or job and can be changed anywhere. So, a macro variable referenced inside a macro definition is global if a global macro variable already exists by the same name (assuming the variable is not explicitly defined as local with the %LOCAL statement or in a parameter list). The new macro variable definition simply updates the existing global one. Exceptions that prevent you from referencing the value of a global macro variable are
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.