Feb 2, 2011

Running SAS on Unix in Batch mode...

Alternative to Interactive SAS discussed @ http://sastechies.blogspot.com/2010/02/running-sas-on-unix-interactively-using.html one can use SAS in batch mode.
SAS in batch mode…
Create a .sas file and pasted the above code at your desired location on your unix box….if you are using PC then create the file and ftp it to your home drive (i.e. ~/)
The batch SAS command would be –
/opt/sas/sasb /pathtosasprog/prog.sas –log /pathtologfile/prog.log –print /pathtooutput/prog.lst
I have put the prog.sas in my home directory on the unix box which can be accessed by the path “~”
The command executed in the example below is -
/opt/sas/sasb ~/prog.sas -print ~/prog.lst -log ~/prog.log
SAS executes the sas program prog.sas located in my home directory (i.e. ~/) and sends any output to ~/prog.lst and the log to ~/prog.log.
Screes shot below shows the code in prog.sas located in my home directory…and then later the batch command I wanted to execute…
SAS on Unix Batch Mode
This screen shot shows the execution and the text getting printed to the terminal…
SAS on unix -- Batch Mode execution
This screen shot shows the log printed to the ~/prog.log file…
SAS on unix -- Batch Mode Output
The SAS example does not generate any SAS output…so ~/prog.st is not created for this instance.