DATA Step, Macro, Functions and more

How to force updates to SAS Log?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 10
Accepted Solution

How to force updates to SAS Log?

Hello,

 

I am running a SAS program on UNIX, but I think my question applies to all platforms.

 

My program runs the code shown below. The macro variable _ENV resolves to DEV or UAT or PROD to show the runtime environment. The code executes a waiting period to allow another process time to complete. In DEV the waiting time is set smaller because we have smaller data. The INFO message to the SAS Log is designed to show anybody monitoring the SAS Log how long they can expect to wait for progress.

 

However, the INFO message usually does not appear in the SAS Log until after the waiting period is already finished. I guess this is because the SAS Log is updated in "pages", and will only be refreshed after a certain number of lines are available to be written to it.   

 

Is there any SAS statement which can force the SAS Log to be updated/refreshed immediately?

 

Is there any SAS option which can set the SAS Log to be updated with greater frequency?

 

Thanks & Regards,

Antony

 

%let sleepmins=%sysfunc(IFN(&_ENV.=DEV,5,30));

%put >>> INFO: Sleeping for &sleepmins. minutes in &_ENV. to allow ORACLE Loading to complete.;

data _null_;

    slept=sleep(60*&sleepmins.,1);

run;


Accepted Solutions
Solution
‎11-16-2017 10:11 AM
Valued Guide
Posts: 596

Re: How to force updates to SAS Log?


All Replies
Solution
‎11-16-2017 10:11 AM
Valued Guide
Posts: 596

Re: How to force updates to SAS Log?

Try adding -logparm "write=immediate" to your SAS invocation as in this link http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002303556.htm

Occasional Contributor
Posts: 10

Re: How to force updates to SAS Log?

[ Edited ]
Posted in reply to ChrisBrooks

Hi Mr Brooks . . .

 

Thanks VERY much for your reply.

 

As luck would have it, I'm in a position to be able to alter the shell script that kicks off our UNIX programs. So I'm able to extend the -LOGPARM setting with this additional parameter.

 

My INFO message now appears before the wait period starts Smiley Happy

 

Assuming no performance issues with our other programs, I will implement/promote this change to the shell script . . . thanks!

 

Regards,

Antony

Frequent Contributor
Posts: 102

Re: How to force updates to SAS Log?

Hopefully @ChrisBrooks solution works out for you, that's probably the best way to handle this.  If not though you can take an approach I've been using for the past several years, which is to output critical data to a separate log file that you control manually.  I initially developed a macro that uses the standard file commands (FILENAME, FOPEN, FPUT, FAPPEND, FCLOSE, etc) to write summary text out to a text file when I was working in a very locked down SAS environment, but since then I've found that the approach is incredibly useful even in an open environment.  Basically it lets you create a very concise log file with only the exact things you care about seeing in it.  I've found it especially useful when dealing with extremely long programs where I can monitor the progress a lot easier.  Recently I also modified my version of this code so that in addition to outputting data to a secondary log file, it also prints it's output directly to the command line so you can follow the progress of a batch program in real-time without even needing to open a separate file.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 243 views
  • 2 likes
  • 3 in conversation