![]() Chapter Contents |
![]() Previous |
![]() Next |
| MPRINT |
| Type: | System option | ||||
| Can be specified in: |
| ||||
| Default: | NOMPRINT | ||||
| See also: | MFILE |
| Syntax | |
| Details | |
| Examples | |
| Example 1: Tracing Generation of SAS Statements | |
| Example 2: Directing MPRINT Output to an External File | |
Syntax |
| MPRINT | NOMPRINT |
| 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. Each statement ends with a semicolon.
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.
| Examples |
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)
Executing this program writes this MPRINT output to the SAS log:
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;
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';
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.