12-04-2014 06:10 PM
SAS 9.3 on Windows
My config file contains:
with upstream config file directives to timestamp the logfile as Sysin_Filename_YYYYMMDD_HHMMSS.log
Is there a way to make SAS "self-aware" about the actual log filename it's writing to?
%sysfunction(getoption(log)) returns E:\Logs\Some\Path\Sysin_Filename_, not the timestamped log filename.
I want to put the actual log filename in a SAS generated email message when an error occurs.
Two ways that I think will work:
But I was hoping there's a more obvious less kludgy approach.
12-04-2014 06:27 PM
12-04-2014 07:08 PM
FYI, here's the approach I'm currently using. Credit for the original code (slight modifications by me) goes to M. Dixon of Selerity.
Let me know if you think there's a better approach...
* capture the timestamped log filename ;
filename cmd pipe "handle -p &SYSJOBID";
* delete unwanted lines ;
if not prxmatch("#\.log(_\d+)*$#io",strip(_infile_)) then delete;
if prxmatch("#\\arm#io",strip(_infile_)) then delete;
* capture log file ;
if prxmatch(re,strip(_infile_)) then log=prxposn(re,1,strip(_infile_));
filename cmd clear;
As per my original post, I think SAS should make this a bit easier...