[Tutor] executing SAS and passing parameters

Williams, Thomas WilliTf at dshs.wa.gov
Wed Feb 9 16:49:55 CET 2005


Here is the code I am using to invoke SAS:

	import os
	import sys

	shell = os.environ.get('COMSPEC')
	if shell is None: shell = os.environ.get('SHELL')
	if shell is None: shell = 'an unknown command processor'
	print 'Running under', shell

	os.execl('C:\Program Files\SAS Institute\SAS\V8\SAS.exe')


However, the program in question is c:\work\run_ratios.sas, with 2
parameters: incov, and outcov.  This program was initially invoked from an
aml program.  The code that invoked SAS from this aml is:

	&SYSTEM %.SASLOC% -SYSPARM %sas_parm% -log ~
%.ARCLOC%\ratios\log\%.file%.log -SYSIN ~
%.ARCLOC%\sas_code\ratios\new_ratio.sas

%.SASLOC%: the SAS executable file ('C:\Program Files\SAS
Institute\SAS\V8\SAS.exe')
%sas_parm%: the list of parameters to be passed onto SAS
%.file%: the name of the log file that is generated during the execution of
the SAS program.
%.ARCLOC%: directory of the SAS program (c:\work)

I think this is an excellent forum to share ideas and solve problems.  Thank
you ever so much for your assistance with this.




More information about the Tutor mailing list