I can open a sas instance but im not certain how to get it to run a specific sas script.
Im using the following code to start sas:
import subprocess
subprocess.call(['C:\Program Files\SAS\SASFoundation\9.2\sas.exe'])
I can open a sas instance but im not certain how to get it to run a specific sas script.
Im using the following code to start sas:
import subprocess
subprocess.call(['C:\Program Files\SAS\SASFoundation\9.2\sas.exe'])
You can pass additional parameters through to SAS via subprocess call, but the important things you also need to remember are:
You need to tell SAS where to find the AUTOEXEC file
You need to tell SAS where to find the config file
I have a shell script that I use to invoke SAS scripts and the call looks like:
sas -config $SAS_CONFIG -autoexec $SAS_AUTOEXEC $SAS_CODE/$1
So your call should look like:
subprocess.call(['C:\Program Files\SAS\SASFoundation\9.2\sas.exe', '-config', config_path, '-autoexec', autoexec_path, '-sysin', sas_script_path])
You'll need to set up the variables for the paths above.
Good luck!