Chapter Contents

Previous

Next
MLOGIC

MLOGIC



Controls whether macro execution is traced for debugging

Type: System option
Can be specified in:
Configuration file
OPTIONS window
OPTIONS statement
SAS invocation
Default: NOMLOGIC


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

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

For more information on macro debugging, see Chapter 10, "Macro Facility Error Messages and Debugging," in SAS Macro Language: Reference.


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)

Executing this program writes this MLOGIC output 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.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.