Is there a way to redirect put statements within the data step to the result rather than the log?
Using PUT statement uses as default the FILE LOG output;
You can define any other output including FILE PRINT to have the output on result window.
data _null_;
file print; put 'Output to result window';
file log; put 'Return to default';
run;
Show us what your trying to do. What are your writing to log matters.
I'm using SAS 9.4 under AIX 7 with bash. I'm trying to redirect the output from put statements into a file. I want the following command to output "hello, foobar" to stdout.
sas -stdio <(echo 'data _null_; put "hello, foobar"; run;') 2>/dev/null
It seems the only way to accomplish this is to explicitly use the file statement like this:
sas -stdio <(echo 'data _null_; file stdout; put "hello, foobar"; run;') 2>/dev/null
Using PUT statement uses as default the FILE LOG output;
You can define any other output including FILE PRINT to have the output on result window.
data _null_;
file print; put 'Output to result window';
file log; put 'Return to default';
run;
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
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.
Ready to level-up your skills? Choose your own adventure.