Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SAS log output to log window and text file

Tags:

debugging

sas

I'm using SAS 9.3. By default, log output goes into the log window. One can instead send the log to a file using:

proc printto
  log="C:\archive\mylog.log" new; 
run;

...But does anyone know of a way to have BOTH? I.e., the log prints to the log window within SAS as well as writing to the text file? Basically, tee for SAS?

Thanks!

like image 793
Chris Avatar asked Oct 20 '22 12:10

Chris


1 Answers

I've seen this question before on other sites, and I believe the answer is mostly "no" with a list of workarounds and one system option.

In a Unix/Linux environment, you can printto a file, but 'tail' that file to get a constantly updating log.

In Windows, you can printto a file and open in something like Textpad, UltraEdit, or Notepad++, and then ask it to reload the file (most editors will prompt you to once it realizes a change occurred).

You also could do it the other way; you could NOT use printto for the log, but then save your log after the program completes (either by just asking it to save via program commands in your program, or by attaching a macro to the run command.) This page gives an example of this, although the code was written for SAS v6 and thus might need to be modified significantly.

Finally, the one way you can truly do this is using the altlog system option. That is only valid on startup or in the configuration file, however, so it is difficult to customize per project - but if your work is such that you can have a special shortcut for each project's production run, this may be feasible. Specifying ALTLOG in the shortcut or the config file allows you to send the log to an alternate location in addition to the screen. See this article for more detail.

like image 127
Joe Avatar answered Nov 09 '22 17:11

Joe