BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
tomcmacdonald
Quartz | Level 8

Is there a way to redirect put statements within the data step to the result rather than the log?

1 ACCEPTED SOLUTION

Accepted Solutions
Shmuel
Garnet | Level 18

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;

View solution in original post

4 REPLIES 4
SuryaKiran
Meteorite | Level 14

Show us what your trying to do. What are your writing to log matters.

Thanks,
Suryakiran
tomcmacdonald
Quartz | Level 8

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
Shmuel
Garnet | Level 18

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;
mounikaupshot
Calcite | Level 5

Inside your script file, put all of the commands within parentheses, like this:

(echo start
ls -l
echo end) | tee foo.log

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2454 views
  • 6 likes
  • 4 in conversation