Thursday, April 20, 2017

( SYMBOLGEN MPRINT MLOGIC MCOMPILENOTE MSGLEVEL ) Macro Debugging Options (SAS)

In future articles, I will be discussing and displaying some of the macros that I have created and often utilize. In the interim, I would like to list a few options that can be enabled in the header portion of SAS programs, that I feel, make macro usage/writing/debugging much easier.

These options are listed above the code, in the header portion of every program that I write. Below is a brief description as to what each option enables.

SYMBOLGEN – Displays the results of resolving macro variable references.

MPRINT - Displays the SAS statements that are generated by macro execution.

MLOGIC - Specifies that the macro language processor trace its execution and write the trace information to the SAS log.

MCOMPILENOTE - Will cause a note to be issued to the SAS log when a macro has completed compilation.

MSGLEVEL (I)- Specifies to print additional notes pertaining to index usage, merge processing, and sort utilities, along with standard notes, warnings, CEDA message, and error messages.

MSGLEVEL is not macro specific, but I recommend enabling it for its general usefulness. This option simply prints additional messages to the SAS log as the SAS application processes code.

The other options listed are specifically related to macro usage and compiling.

MCOMPILENOTE is especially useful as it notifies the user, by writing a message to the SAS log, as to whether or not a macro compiled correctly.




When the SYMLOGEN, MPRINT, MLOGIC, and MCOMPILENOTE are enabled in tandem, and a macro is processing data, your log window should resemble something similar to:




To enable each of these options individually or together, utilize the code below:

Option SYMBOLGEN MPRINT MLOGIC;

Options MCOMPILENOTE = ALL;

Options MSGLEVEL = I;


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.