Previous Page | Next Page

System Options for Macros

CMDMAC System Option

Controls command-style macro invocation.
Valid in:

Configuration file

OPTIONS window

OPTIONS statement

SAS invocation

Type: System option





specifies that the macro processor examine the first word of every windowing environment command to see whether it is a command-style macro invocation.

Note:   When CMDMAC is in effect, SAS searches the macro libraries first and executes any member it finds with the same name as the first word in the windowing environment command that was issued. Unexpected results can occur.  [cautionend]


specifies that no check be made for command-style macro invocations. If the macro processor encounters a command-style macro call when NOCMDMAC is in effect, it treats the call as a SAS command and produces an error message if the command is not valid or is not used correctly.


The CMDMAC system option controls whether macros defined as command-style macros can be invoked with command-style macro calls or if these macros must be invoked with name-style macro calls. These two examples illustrate command-style and name-style macro calls, respectively:

When you use CMDMAC, processing time is increased because the macro facility searches the macros compiled during the current session for a name corresponding to the first word on the command line. If the MSTORED option is in effect, the libraries containing compiled stored macros are searched for a name corresponding to that word. If the MAUTOSOURCE option is in effect, the autocall libraries are searched for a name corresponding to that word. If the MRECALL system option is also in effect, processing time can be increased further because the search continues even if a word was not found in a previous search.

Regardless of which option is in effect, you can use a name-style invocation to call any macro, including command-style macros.


Name-style macros are the more efficient choice for invoking macros because the macro processor searches only for a macro name corresponding to a word following a percent sign.

Previous Page | Next Page | Top of Page