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

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;

1 ACCEPTED SOLUTION

Accepted Solutions
3 REPLIES 3
ChrisBrooks
Ammonite | Level 13

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

aknight1
Obsidian | Level 7

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 🙂

 

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

 

Regards,

Antony

Sven111
Pyrite | Level 9

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2423 views
  • 3 likes
  • 3 in conversation