Running SAS Jobs

Follow

Windows Command Procedure Execution Method

Below is an example of a SAS Job's Source:

c:\YourSASPath\sas.exe
  -autoexec d:\sas\autoexec.sas
  -config d:\sas\config.sas
  -nologo
  -log d:\work\logs\pull_sample200102131244.log
  -sysin d:\YourDir\YourProgram.sas

You may also create a custom Execution Method using the Command Execution Method as a base. Modify the Command field in the Execution tab, as shown below.

Check Interactive as SAS.exe causes an interactive pop-up window to appear.

Note: You may have to start the Interactive Services Detection service for an interactive Job to work properly.

Method_Name_SAS_rev.png

Update the Command field of the SAS Execution Method. This way, the Job Definition Source tab contains the contents of your SAS program. We recommend using the example command line in the Command field: 

"C:\Program Files\SAS\SASfoundations\9.2\SAS.EXE" -SysIn "{0}" -config d:\sas\config.sas -NOSPLASH

Below is a sample SAS Job:

SAS_Sample_rev.png 

SAS Projects (saved as .EGP files) can also be saved as Visual Basic scripts from the SAS Enterprise Guide and executed using the JAMS VBScript Execution Method.

 

PowerShell Execution Method

Below is an example of a SAS Job Source which writes output to a logfile named according to the name of the JAMS Job and the numerical day of the week. It then retrieves the SAS log output and includes it in the JAMS Job log.

$dow=(Get-Date).DayOfWeek.value__
$logFile = "E:\Jams_logs\" + "<<JAMS.JobName>>" + "_" + $dow + ".log"

cmd /c "E:\SAS\SASHome\SASFoundation\9.4\sas.exe -config E:\SAS\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg -log $logFile -sysin 16052.sas"

Get-Content $LogFile

 


See Also

SAS Options

SAS Support

 

 

Have more questions? Submit a request

Comments