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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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