Using Autocall Macros
To use an autocall macro, call it in your program with the statement %macro-name. The
macro processor searches first in the Work library for a compiled macro definition with
that name. If the macro processor does not find a compiled macro and if the
MAUTOSOURCE is in effect, the macro processor searches the libraries specified by
the SASAUTOS option for a member with that name. When the macro processor finds
the member, it does the following:
1. compiles all of the source statements in that member, including all macro definitions
2. executes any open code (macro statements or SAS source statements not within any
macro definition) in that member
3. executes the macro with the name that you invoked
After the macro is compiled, it is stored in the Work.SASMacr catalog and is available
for use in the SAS session without having to be recompiled.
You can also create your own autocall macros and store them in libraries for easy
execution. For more information, see Chapter 9, “Storing and Reusing Macros,” on page
115.
Autocall Macros for Double-Byte Character Set (DBCS)
Because East Asian languages have thousands of characters, double (two) bytes of
information are needed to represent each character. Each East Asian language usually
has more than one DBCS encoding system. SAS processes the DBCS encoding
information that is unique for the major East Asian languages. The following table
contains definitions for the autocall macros that support DBCS.
Table 12.14 Autocall Macros for DBCS
Autocall Macros Description
%KLOWCASE and %QKLOWCAS Changes the uppercase characters to lowercase.
%KTRIM and %QKTRIM Trims the trailing blanks.
%KVERIFY Returns the position of the first character unique to an expression.
For more information, see “Dictionary of Autocall Macros for NLS” in SAS National
Language Support (NLS): Reference Guide.
Selected System Options Used in the Macro
Facility
The following table lists the SAS system options that apply to the macro facility.
Selected System Options Used in the Macro Facility 173
Table 12.15 System Options Used in the Macro Facility
Option Description
CMDMAC Controls command-style macro invocation.
IMPLMAC Controls statement-style macro invocation.
MACRO Controls whether the SAS macro language is available.
MAUTOCOMPLOC Displays in the SAS log the source location of the autocall macros
when the autocall macro is compiled.
MAUTOLOCDISPLAY Displays the source location of the autocall macros in the SAS log
when the autocall macro is invoked.
MAUTOLOCINDES Specifies whether the macro processor prepends the full
pathname of the autocall source file to the description field of the
catalog entry of compiled auto call macro definition in the
Work.SASMacr catalog.
MAUTOSOURCE Controls whether the macro autocall feature is available.
MCOMPILE Allows new definitions of macros.
MCOMPILENOTE Issues a NOTE to the SAS log upon the completion of the
compilation of a macro.
MCOVERAGE Enables the generation of coverage analysis data.
MCOVERAGELOC Specifies the location of the coverage analysis data file.
MERROR Controls whether the macro processor issues a warning message
when a macro-like name (%name) does not match a compiled
macro.
MEXECNOTE Displays macro execution information in the SAS log at macro
invocation.
MEXECSIZE Specifies the maximum macro size that can be executed in
memory.
MFILE Determines whether MPRINT output is routed to an external file.
MINDELIMITER Specifies the character to be used as the delimiter for the macro
IN operator.
MINOPERATOR Controls whether the macro processor recognizes the IN (#)
logical operator.
MLOGIC Controls whether macro execution is traced for debugging.
MLOGICNEST Allows the macro nesting information to be displayed in the
MLOGIC output in the SAS log.
174 Chapter 12 Macro Language Elements
Option Description
MPRINT Controls whether SAS statements generated by macro execution
are traced for debugging.
MPRINTNEST Allows the macro nesting information to be displayed in the
MPRINT output in the SAS log.
MRECALL Controls whether the macro processor searches the autocall
libraries for a member that was not found during an earlier search.
MREPLACE Enables existing macros to be redefined.
MSTORED Controls whether stored compiled macros are available.
MSYMTABMAX Specifies the maximum amount of memory available to the macro
variable symbol table or tables.
MVARSIZE Specifies the maximum size for in-memory macro variable
values.
SASAUTOS Specifies one or more autocall libraries.
SASMSTORE Specifies the libref of a SAS library containing a catalog of stored
compiled SAS macros.
SERROR Controls whether the macro processor issues a warning message
when a macro variable reference does not match a macro variable.
SYMBOLGEN Controls whether the results of resolving macro variable
references are displayed for debugging.
SYSPARM Specifies a character string that can be passed to SAS programs.
Selected System Options Used in the Macro Facility 175
176 Chapter 12 Macro Language Elements
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset