proc printto: log and procedure output to same file does not flush %put output to log file

Viewed 1362

I am trying to redirect the log and procedure output to the same destination file for use in an interactive sas session so that I can use tail -f on this file.

So, I do

proc printo print = "/home/tq84/sas.log"; run;
proc printo log   = "/home/tq84/sas.log"; run;

I have set the option logparm to write=immediate.

If I try to write something into the log with %put text;, it does not get immediately written to /home/tq84/sas.log.

However, when I execute a simple proc sql; quit;, the previously buffered log output gets flushed to /home/tq84/sas.log.

I am looking for an idea on how to write both the log and procedure output to the same file and to flush both immediatly when they're available.

1 Answers

This works for me.

Starting sas with

C:\temp>sas -logparm "write=immediate"

I then issue:

proc printto print="c:\temp\test.log";
run;
proc printto log="c:\temp\test.log";
run;

I open the log file in Sublime Text having it refresh when the file does.

Then submit:

%put HI THERE!;

That does not output to the log until I issue a PROC statement. (Assuming a Data Step would work too.)

If I relaunch the session and reorder the PRINTTO

proc printto log="c:\temp\test.log";
run;
proc printto print="c:\temp\test.log";
run;

Then

%put HI THERE!;

Goes to the log ASAP.

Related