BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
qc1
Fluorite | Level 6 qc1
Fluorite | Level 6
I’m new to sas. I need to run my sas program in batch mode on Putty, how do I archive the log to another location? My I have an example of sas codes.
I’m using:

nohup /opt/sas/config/Lev1/SASApp/sas programname.sas &

is that correct?
1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

Below how this looks like in the environment I'm currently working in.

sso/biconfig/940/Lev1/SASApp/BatchServer/sasbatch.sh -log .../logs/program_  -batch -noterminal -logparm "rollover=session"  -sysin .../program.sas

Depending on the config in your environment you will eventually have to add some specific directives to create a log name with a date portion. How to documented here.  

 

Adding the destination and name for printed output explicitly is also not a bad idea. Would be -print ..../program.lst  ....and you could also use some time directives there to not just overwrite your listing output.  ....or if you don't want any listing output then point to /dev/null

View solution in original post

4 REPLIES 4
SASKiwi
PROC Star

This doc should help you. It is best practice to specify log locations using the -LOG option when invoking your batch SAS job 

Tom
Super User Tom
Super User

That should create a file named programname.log (and programname.lst for the "listing" output as they now want to call it) in the current directory.

If you want the files written somewhere else using the -log and -print command line options.

Patrick
Opal | Level 21

Below how this looks like in the environment I'm currently working in.

sso/biconfig/940/Lev1/SASApp/BatchServer/sasbatch.sh -log .../logs/program_  -batch -noterminal -logparm "rollover=session"  -sysin .../program.sas

Depending on the config in your environment you will eventually have to add some specific directives to create a log name with a date portion. How to documented here.  

 

Adding the destination and name for printed output explicitly is also not a bad idea. Would be -print ..../program.lst  ....and you could also use some time directives there to not just overwrite your listing output.  ....or if you don't want any listing output then point to /dev/null

Kurt_Bremser
Super User

Make it a habit to use only fully qualified path names in OS commands, especially when writing shell scripts.

This makes the commandline resilient against any changes in current working directory, and you will often need to redirect stuff like log files because the script won't have write permission on the CWD, and you don't want to clutter up your program directory with logs.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 1596 views
  • 1 like
  • 5 in conversation