[Tutor] ksh and SAS questions

David Ascher da@ski.org
Tue, 18 May 1999 11:08:48 -0700 (Pacific Daylight Time)


On Wed, 12 May 1999 adeline_j_wilcox@ccMail.Census.GOV wrote:

> Using a script named recheck.py, I call a ksh script named 
> setcm.ksh. That script exports some shell variables. I would like to
> substitute the value of one shell variable in particular, named CATI,
> for the value 199904 in lines 14, 23 and 24. Please note that
> I want to pass the value of this shell variable to a SAS program with the
> SYSPARM option in line 23.

You may want to modify the environment variable by modifying the
os.environ dictionary before the os.system() call.

E.g.

os.environ['CATI'] = '199904'

I don't understand why you think that line 14 has anything to do with
environment variables, though -- line 12 does.  So I'd put the
line above before line 12 and that might do the job.

>       12        os.system('/op/ctl/prod/scripts/setcm.ksh')
...
>       14        sys.stdin = open('/op/ctl/prod/data/ro199904.txt','r')
...
>       23        os.system("$SASDIR/sas /op/ctl/prod/prgms/recheck.sas 
>      -sysparm 199904 -log /op/ctl/prod/logs/recheck.log.199904")
>       24        os.system("mailx -s '199904 for you' 

--david