05-07-2013 03:52 PM
I have got a question concerning the macro statement %put. Is there any explanation why the statement %put is not written to the log, if executed from within a macro.
What I don´t understand is the following example:
options mprint ;
The log shows the following
469 options mprint ;
471 %macro test(tt=);
472 %put &tt;
476 %put test;
Why am I not seeing the statments that generated abc and efg whereas the %put test Statement outside the macro is shown. I had expected to get something like this in the log:
MPRINT(test) %put &tt;
Can anyone explain me that?
Thanks a lot in advance
Why doesn´t the log show the statements generated by the macro call (e.g.
05-08-2013 01:41 AM
05-08-2013 02:11 AM
As per documentation, MPRINT will generate all the statements which has been sent to appropriate compiler...And if MPRINT is turnoff you can not see the statements which has been sent to different compilers during Macro Processing...
%PUT outside the macro prints the %PUT statement because it is not within the MACRO...it's outside the MACRO...
If you wish to print %PUT statement during macro processing than use the following code...
%macro test(macvar =);
%put MPRINT(&SYSMACRONAME): %nrstr(%put) %nrstr(&macvar.);
%test(macvar = ABC);
05-08-2013 02:54 AM
Mprint only print the datastep or proc step execution statements in to SAS log, Mlogic will print the %IF or any logical statements used inside the macro. %put execution will not be printed as you expect.
05-08-2013 10:46 AM
How about put it manually ?
%macro test(tt=); %put %nrstr(%put &tt) &tt; %mend; %test(tt=abc); %put test;
options mprint mlogic symbolgen;
Message was edited by: xia keshan