BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Can the %put statement post text to outer file?
4 REPLIES 4
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.
deleted_user
Not applicable
How about just export the specific macro variables that I want instead of the whole log file into external file?
abdullala
Calcite | Level 5
use 'put' statement.
Cynthia_sas
SAS Super FREQ
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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 667 views
  • 0 likes
  • 4 in conversation