How to have sas log in both external location and sas enterprise guide

一个人想着一个人 提交于 2019-12-01 10:43:43
Allan Bowe

There is no 'in session' programmable option to write the log to multiple destinations. However a decent 'hack' is to simply read your external log and write out to your session log as follows:

/* write to external log */
filename tmp "C:\temp\mylog.txt";
proc printto log=tmp; run;

/* now run your SAS code */
%put NOTE: processing lots of juicy SAS statements;

/* once done, return to normal logging */
proc printto log=log; run; 

/* print previous log to current session */
data _null_;
  infile tmp;
  input; list;
run;

/* close filename */
filename tmp clear;

To ensure you always write the log out / get it back, you could even split the above into the following locations:

Other options:

An admin can enable logging on the application (workspace) server. This will capture all logs, from all users - which does have performance and storage implications! Steps as follows:

  • Navigate to: [sasconfig]\Lev1\SASApp\WorkspaceServer
  • Rename logconfig.xml to logconfig.xml.orig
  • Rename Logconfix.trace.xml to logconfig.xml
  • Restart the object spawner

Another approach, as proposed by @Quentin / @Reeza in this (very similar) question, is to use the -altlog option at SAS invocation.

Finally, if it suits, you could look at enabling the EG project log.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!