MLOGIC System Option

Specifies whether the macro processor traces its execution for debugging.
Valid in: Configuration fileOPTIONS windowOPTIONS statementSAS invocation
PROC OPTIONS GROUP= MACRO

LOGCONTROL

Type: System option
Default: NOMLOGIC
See: The SAS Log in SAS Language Reference: Concepts

Syntax

MLOGIC | NOMLOGIC

Required Arguments

MLOGIC
causes the macro processor to trace its execution and to write the trace information to the SAS log. This option is a useful debugging tool.
NOMLOGIC
does not trace execution. Use this option unless you are debugging macros.

Details

Use MLOGIC to debug macros. Each line generated by the MLOGIC option is identified with the prefix MLOGIC(macro-name):. If MLOGIC is in effect and the macro processor encounters a macro invocation, the macro processor displays messages that identify the following:
  • the beginning of macro execution
  • values of macro parameters at invocation
  • execution of each macro program statement
  • whether each %IF condition is true or false
  • the ending of macro execution
Note: Using MLOGIC can produce a great deal of output.
For more information about macro debugging, see Macro Facility Error Messages and Debugging.

Example: Tracing Macro Execution

In this example, MLOGIC traces the execution of the macros MKTITLE and RUNPLOT:
%macro mktitle(proc,data);
    title "%upcase(&proc) of %upcase(&data)";
%mend mktitle;
%macro runplot(ds);
   %if %sysprod(graph)=1 %then
      %do;
         %mktitle (gplot,&ds)
         proc gplot data=&ds;
            plot style*price
                / haxis=0 to 150000 by 50000;
         run;
         quit;
      %end;
   %else
      %do;
         %mktitle (plot,&ds)
         proc plot data=&ds;
            plot style*price;
         run;
         quit;
      %end;
%mend runplot;
options mlogic;
%runplot(sasuser.houses)
When this program executes, this MLOGIC output is written to the SAS log:
MLOGIC(RUNPLOT):  Beginning execution.
MLOGIC(RUNPLOT):  Parameter DS has value sasuser.houses
MLOGIC(RUNPLOT):  %IF condition %sysprod(graph)=1 is TRUE
MLOGIC(MKTITLE):  Beginning execution.
MLOGIC(MKTITLE):  Parameter PROC has value gplot
MLOGIC(MKTITLE):  Parameter DATA has value sasuser.houses
MLOGIC(MKTITLE):  Ending execution.
MLOGIC(RUNPLOT):  Ending execution.