Architecting, installing and maintaining your SAS environment

Log file location using nohup

Occasional Contributor
Posts: 9

Log file location using nohup

Hello, We have 9.4(TS1M3) on Grid. When I submit job to grid in background, log file is getting created in current directory after job completes. Is there a way log file be found while the job is running so I check on the progress of a job?

Please advise!

SAS Employee
Posts: 20

Re: Log file location using nohup

Posted in reply to Priyanka_b

I'm not sure if this is exactly what you're looking for: I've been known to grab the src and log information at the beginning of a SAS job (or at the end) to send myself a quick message when it runs:


/* get job source and log location */
%let job_src=%sysfunc(getoption(sysin));
%let job_log = %sysfunc(getoption(log));

/* send msg with job information */
filename mailbox email subject="Job started: &job_src &job_log"

data _null_;
  file mailbox;
  put "Job started:";
  put / "View the log at %sysfunc(getoption(log))";
  put / "View the src at %sysfunc(getoption(sysin))";
put / "Server hostname is &systcpiphostname"; run;

I haven't tried this on Grid (I expect that it works), so hope this helps.

Super User
Posts: 9,868

Re: Log file location using nohup

Posted in reply to Priyanka_b

I do the following (this is for all our batch jobs):

- the wrapper script for SAS bacth jobs determines a timestamp and process number

- timestamp and process number are used to create the filename for the log file, used with the -log commandline option

- the wrapper script runs a quick SAS program that writes all pertinent information (parameters, program name, time etc) to a SAS dataset; return code is set to -1, and a HTML navigation page for the current day is written, containing all jobs from the day, with links to the log file location

- once the main job has run, a similar SAS program runs that adds the final return code to the jobcontrol dataset, and recreates the navigation page


As soon as a job runs, I get an entry in today's jobcontrol page on the web server (return code is "running"). Clicking on the link that is attached to the program name will display the log. With "reload" I can watch the job's progress.

Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
SAS Employee
Posts: 512

Re: Log file location using nohup

Posted in reply to Priyanka_b

Maybe you need to use PROC PRINTTO in your SAS program?

Ask a Question
Discussion stats
  • 3 replies
  • 4 in conversation