DATA Step, Macro, Functions and more

Can the %put statement post text to outer file?

Reply
N/A
Posts: 0

Can the %put statement post text to outer file?

Can the %put statement post text to outer file?
Super Contributor
Super Contributor
Posts: 3,174

Re: Can the %put statement post text to outer file?

Posted in reply to deleted_user
The macro language %PUT statement, as document, "normally" posts / outputs macro processing diagnostic messages, including macro variable values, to the SAS log, however, yes, it is possible to re-direct the SAS-generated log to an external file using PROC PRINTTO.

Scott Barry
SBBWorks, Inc.
N/A
Posts: 0

Re: Can the %put statement post text to outer file?

How about just export the specific macro variables that I want instead of the whole log file into external file?
Contributor
Posts: 74

Re: Can the %put statement post text to outer file?

Posted in reply to deleted_user
use 'put' statement.
SAS Super FREQ
Posts: 8,868

Re: Can the %put statement post text to outer file?

Posted in reply to deleted_user
Hi:
Something similar to this technique might work for you:
[pre]
** Use PROC PRINTTO to get ONLY list of Macro vars;
filename mylog "c:\temp\allmacvars.txt";
PROC PRINTTO log=mylog; run;
%put _all_;
PROC PRINTTO; run;
[/pre]

The PROC PRINTTO steps surround the %PUT _ALL_ -- so this will effectively capture what is written to the log as the result of the %PUT _ALL_ and then the log will return to normal after the second PROC PRINTTO.

You could, of course, put any number of specific %PUT statements in between the PRINTTO steps.

cynthia
Ask a Question
Discussion stats
  • 4 replies
  • 201 views
  • 0 likes
  • 4 in conversation