Previous Page | Next Page

System Options for Macros

MLOGIC System Option



Specifies whether the macro processor traces its execution for debugging.
Valid in:

Configuration file

OPTIONS window

OPTIONS statement

SAS invocation

Type: System option
Default: NOMLOGIC
PROC OPTIONS GROUP= MACRO
LOGCONTROL
See Also: The SAS Log

Syntax
Details
Example
Tracing Macro Execution

Syntax

MLOGIC | NOMLOGIC

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:

Note:   Using MLOGIC can produce a great deal of output.  [cautionend]

For more information about macro debugging, see Macro Facility Error Messages and Debugging.


Example


Example 1: 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.

Previous Page | Next Page | Top of Page