DATA Step Functions for Macros |
Type: | DATA step function |
Syntax | |
Required Argument | |
Details | |
Examples |
Syntax |
SYMGLOBL (argument) |
can be one of the following items:
the name of a macro variable within quotation marks but without an ampersand
the name of a DATA step character variable, specified with no quotation marks, that contains a macro variable name
a character expression that constructs a macro variable name
Details |
The SYMGLOBL function searches enclosing scopes for the indicated macro variable and returns a value of 1 if the macro variable is found in the global symbol table, otherwise it returns a 0. See Scopes of Macro Variables for more information about the global and local symbol tables and macro variable scopes.
Examples |
The following example of the %TEST macro contains the SYMGLOBL function:
%global x; %macro test; %local y; data null; if symglobl("x") then put "x is GLOBAL"; else put "x is not GLOBAL"; if symglobl("y") then put "y is GLOBAL"; else put "y is not GLOBAL"; if symglobl("z") then put "z is GLOBAL"; else put "z is not GLOBAL"; run; %mend test; %test;
In the previous example, executing the %TEST macro, which contains the SYMGLOBL function, writes the following output to the SAS log:
x is GLOBAL y is not GLOBAL z is not GLOBAL
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.