Category: Macro
PROC OPTIONS
GROUP=
MACRO
LOGCONTROL
Type: System option
Default: NOMLOGICNEST
See: “The SAS Log” in SAS Language Reference: Concepts
Syntax
MLOGICNEST | NOMLOGICNEST
Required Arguments
MLOGICNEST
enables the macro nesting information to be displayed in the MLOGIC output in the
SAS log.
NOMLOGICNEST
prevents the macro nesting information from being displayed in the MLOGIC output
in the SAS log.
Details
MLOGICNEST enables the macro nesting information to be written to the SAS log in
the MLOGIC output.
The setting of MLOGICNEST does not affect the output of any currently executing
macro.
The setting of MLOGICNEST does not imply the setting of MLOGIC. You must set
both MLOGIC and MLOGICNEST in order for output (with nesting information) to be
written to the SAS log.
Example: Using MLOGICNEST System Option
The first example shows both the MLOGIC and MLOGICNEST options being set:
%macro outer;
%put THIS IS OUTER;
%inner;
%mend outer;
%macro inner;
%put THIS IS INNER;
%inrmost;
%mend inner;
%macro inrmost;
%put THIS IS INRMOST;
%mend;
options mlogic mlogicnest;
%outer
Here is the MLOGIC output in the SAS log using the MLOGICNEST option:
MLOGIC(OUTER): Beginning execution.
MLOGIC(OUTER): %PUT THIS IS OUTER
THIS IS OUTER
374 Chapter 20 System Options for Macros
MLOGIC(OUTER.INNER): Beginning execution.
MLOGIC(OUTER.INNER): %PUT THIS IS INNER
THIS IS INNER
MLOGIC(OUTER.INNER.INRMOST): Beginning execution.
MLOGIC(OUTER.INNER.INRMOST): %PUT THIS IS INRMOST
THIS IS INRMOST
MLOGIC(OUTER.INNER.INRMOST): Ending execution.
MLOGIC(OUTER.INNER): Ending execution.
MLOGIC(OUTER): Ending execution.
The second example uses only the NOMLOGICNEST option:
%macro outer;
%put THIS IS OUTER;
%inner;
%mend outer;
%macro inner;
%put THIS IS INNER;
%inrmost;
%mend inner;
%macro inrmost;
%put THIS IS INRMOST;
%mend;
options nomlogicnest;
%outer
Here is the output in the SAS log when you use only the NOMLOGICNEST option:
MLOGIC(OUTER): Beginning execution.
MLOGIC(OUTER): %PUT THIS IS OUTER
THIS IS OUTER
MLOGIC(INNER): Beginning execution.
MLOGIC(INNER): %PUT THIS IS INNER
THIS IS INNER
MLOGIC(INRMOST): Beginning execution.
MLOGIC(INRMOST): %PUT THIS IS INRMOST
THIS IS INRMOST
MLOGIC(INRMOST): Ending execution.
MLOGIC(INNER): Ending execution.
MLOGIC(OUTER): Ending execution.
MPRINT System Option
Specifies whether SAS statements generated by macro execution are traced for debugging.
Valid in: Configuration file, OPTIONS window, OPTIONS statement, SAS invocation
Category: Macro
PROC OPTIONS
GROUP=
MACRO
LOGCONTROL
Type: System option
Default: NOMPRINT
See: “MFILE System Option” on page 368 and “The SAS Log” in SAS Language
Reference: Concepts
MPRINT System Option 375
Syntax
MPRINT | NOMPRINT
Required Arguments
MPRINT
displays the SAS statements that are generated by macro execution. The SAS
statements are useful for debugging macros.
NOMPRINT
does not display SAS statements that are generated by macro execution.
Details
The MPRINT option displays the text generated by macro execution. Each SAS
statement begins a new line. Each line of MPRINT output is identified with the prefix
MPRINT(macro-name):, to identify the macro that generates the statement. Tokens that
are separated by multiple spaces are printed with one intervening space.
You can direct MPRINT output to an external file by also using the MFILE option and
assigning the fileref MPrint to that file. For more information, see “MFILE System
Option” on page 368.
Examples
Example 1: Tracing Generation of SAS Statements
In this example, MPRINT traces the SAS statements that are generated when the macros
MKTITLE and RUNPLOT execute:
%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 mprint;
%runplot(Sasuser.Houses)
When this program executes, this MPRINT output is written to the SAS log:
376 Chapter 20 System Options for Macros
MPRINT(MKTITLE): TITLE "GPLOT of SASUSER.HOUSES";
MPRINT(RUNPLOT): PROC GPLOT DATA=SASUSER.HOUSES;
MPRINT(RUNPLOT): PLOT STYLE*PRICE / HAXIS=0 TO 150000 BY 50000;
MPRINT(RUNPLOT): RUN;
MPRINT(RUNPLOT): QUIT;
Example 2: Directing MPRINT Output to an External File
Adding these statements before the macro call in the previous program sends the
MPRINT output to the file DebugMac when the SAS session ends.
options mfile mprint;
filename mprint 'debugmac';
MPRINTNEST System Option
Specifies whether to display the macro nesting information in the MPRINT output in the SAS log.
Valid in: Configuration file, OPTIONS window, OPTIONS statement, SAS invocation
Category: Macro
PROC OPTIONS
GROUP=
MACRO
Type: System option
Default: NOMPRINTNEST
Syntax
MPRINTNEST | NOMPRINTNEST
Required Arguments
MPRINTNEST
enables the macro nesting information to be displayed in the MPRINT output in the
SAS log.
NOMPRINTNEST
prevents the macro nesting information from being displayed in the MPRINT output
in the SAS log.
Details
MPRINTNEST enables the macro nesting information to be written to the SAS log in
the MPRINT output. The MPRINTNEST output has no effect on the MPRINT output
that is sent to an external file. For more information, see MFILE System Option.
The setting of MPRINTNEST does not imply the setting of MPRINT. You must set both
MPRINT and MPRINTNEST in order for output (with the nesting information) to be
written to the SAS log.
Example: Using MPRINTNEST System Option
The following example uses the MPRINT and MPRINTNEST options:
%macro outer;
data _null_;
MPRINTNEST System Option 377
%inner
run;
%mend outer;
%macro inner;
put %inrmost;
%mend inner;
%macro inrmost;
'This is the text of the PUT statement'
%mend inrmost;
options mprint mprintnest;
%outer
Here is the output written to the SAS log using both the MPRINT option and the
MPRINTNEST option:
MPRINT(OUTER): data _null_;
MPRINT(OUTER.INNER): put
MPRINT(OUTER.INNER.INRMOST): 'This is the text of the PUT statement'
MPRINT(OUTER.INNER): ;
MPRINT(OUTER): run;
This is the text of the PUT statement
NOTE: DATA statement used (Total process time):
real time 0.10 seconds
cpu time 0.06 seconds
Here is an example that uses the NOMPRINTNEST option:
%macro outer;
data _null_;
%inner
run;
%mend outer;
%macro inner;
put %inrmost;
%mend inner;
%macro inrmost;
'This is the text of the PUT statement'
%mend inrmost;
options nomprintnest;
%outer
Here is the output written to the SAS log using the NOMPRINTNEST option:
MPRINT(OUTER): data _null_;
MPRINT(INNER): put
MPRINT(INRMOST): 'This is the text of the PUT statement'
MPRINT(INNER): ;
MPRINT(OUTER): run;
This is the text of the PUT statement
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds
MRECALL System Option
Specifies whether autocall libraries are searched for a member that was not found during an earlier search.
378 Chapter 20 System Options for Macros
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset