[Tutor] executing SAS and passing parameters

Alan Gauld alan.gauld at freenet.co.uk
Wed Feb 9 23:18:07 CET 2005


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

You might find that os.system() is all you need here,
but if execl works don't worry too much.

> 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:

Wacky stuff it remindss me of JCL on an MVS mainframe.
What exactly is AML? Is it a SAS specific thing?


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

I'm assuming the ~ characters are line continuations?
So the above is effectively one long line?

If so translating it becomes:

<path>/sas.exe -<params> -log <path>/%file%.log -f(?)
<path>new_ratio.sas

If so, you could try that from your command prompt.
If it works just build the string and insert it into
an os.system() call.

I think the real issue here is extracting the actuial command
line from the AML code (and probably the SAS documentation for
startup parameters). Once you've got it working from an
interactive command line (ie Cmd.exe Box in NT) then getting
Python to replicate that should be straighforward.

Alan G.



More information about the Tutor mailing list