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

Hi,

 

If I have a batch SAS job running in Windows, is there any way I can find out what the current path/name is of the log file it is generating?

I need to pass that to a log analyzer that I call at the end of the job.

 

Thanks!

 

--Ben

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hi @BenConner,

 

From within the running batch job you can retrieve the value of the LOG system option, i.e.,

%sysfunc(getoption(log))

will evaluate to the path of the log file. This would, however, not reflect redirections of the log via PROC PRINTTO calls in the program, if any. But if you wrote a PROC PRINTTO step, you would likely know the path anyway.

View solution in original post

3 REPLIES 3
ballardw
Super User

How are you running the batch job?

The command line used should allow you to set the output destination of the LOG or setting the Log options in the configuration file use or using proc printto

 

For example of a command line:

  1. "C:\Program Files\SASHome\SASFoundation\9.4\Sas.exe"-SYSIN c:\job1.bat -NOSPLASH -ICON -PRINT c:\job1.lst –LOG c:\job1.log.

The  -Log sets the location of the log file to c:\job1.log

FreelanceReinh
Jade | Level 19

Hi @BenConner,

 

From within the running batch job you can retrieve the value of the LOG system option, i.e.,

%sysfunc(getoption(log))

will evaluate to the path of the log file. This would, however, not reflect redirections of the log via PROC PRINTTO calls in the program, if any. But if you wrote a PROC PRINTTO step, you would likely know the path anyway.

BenConner
Pyrite | Level 9

Perfect.  That's exactly what I was looking for.  Rather than the %sysfunc, I just used a simple data step to test with  but I think sysfunc would work better in the actual application.

Thanks much!

 

--Ben

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1361 views
  • 0 likes
  • 3 in conversation