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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.