How do I create log files from the workbench?
The workbench is an interactive GUI for developing and diagnosing SAS language scripts. The log and listing output are 'tabs' in the custom perspective of this framework and as such are a 'view' of what is going on when a full or part of a program is executed.
Once you have your program working the intention is that you would run your programs from the command line using the wps.exe tool if you need separate and distinctive log and listing output in a batch mode of operation. For example,
<slc_install_root>\bin\wps.exe program.sas -log program.log -print program.lst
This can potentially be scripted so that 'program' becomes %1% or a parameter passed as an argument.
However if you wish to continue to use the workbench then you will need to use the SAS language to re-direct the log information to separate files. The PROC PRINTTO LOG="path to log file" NEW; RUN; statement can do this.
One example of doing this would be to autoload a couple of macros %openlog() and %closelog(). The %openlog() would have to be called as custom pre-code injection and the %closelog() as custom post-code injection. In this way whichever SAS language program you run, a new external log file would be created. Enabling custom code can be done in Window->Preferences->Altair->Code Injection.
Defining the names of log files would be entirely at your discretion but a simple timestamp arrangement could be something like:
%macro openlog(logfile=%sysfunc(getoption(SASUSER))/slc%sysfunc(datetime()).log);
%put Writing LOG output to file: &logfile;
PROC PRINTTO LOG = "&logfile" NEW; RUN;
%mend;
%macro closelog();
PROC PRINTTO; RUN;
%mend;
Calling these macros would create default log files in your SASUSER area:
%openlog()
execute script
%closelog()