Date: Mon, 24 Feb 2003 19:34:05 +0000
Reply-To: SAS User <sasuser@GUILDENSTERN.DYNDNS.ORG>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: SAS User <sasuser@GUILDENSTERN.DYNDNS.ORG>
Subject: Re: shebang notation on Unix...or cygwin?
Content-Type: text/plain; charset=us-ascii
on Mon, Feb 24, 2003 at 10:58:40AM -0800, Curt Seeliger (seeliger.curt@EPA.GOV) wrote:
> On Monday 24 February 2003 09:49 am, you wrote:
> > Not having SAS/Unix handy, I can't test this myself. Wondering if
> > anyone's found that SAS can be run using "shebang" notation:
> > #!/<path to sas executable>/sas
> > ...with appropriate options to SAS (possibly '-stdio') to get it to
> > read inputs.
> > ...it also writes the output to 'myprog.log' rather than stdout, and
> > can't appear to deal with invocations of the script from another
> > directory. Note that SAS/PC doesn't respect the -stdio system option.
> > Further option would be to write a wrapper which passes the program to
> > SAS and recovers the output. This would seem to be somewhat
> > complicated.
> I've not had luck with it under Linux, getting the same "ERROR 180-322:
> Statement is not valid" that you describe, as above or with the -stdio
> option. Furthermore, it won't define my librefs:
> #!/opt/bin/sas8/sas -noterminal -work
> /opt/bin/sas8/work/ -log ~/bin/output/test.log -print
> /* test of sas via shebang
> libname test '/opt/data/strmsed/total/';
> proc contents data=test.thalweg; run;
> ERROR: Libname TEST is not assigned.
That's because 'libname test...' is actually a continuation of the "SAS
statement" beginning "#!/opt/bin/sas8/sas...". That is: SAS isn't
dropping the first line of the input program.
What's required is some sort of 'sasscript' shell wrapper which is what
your SAS programs invoke. This would read the shebang line for options,
save them to be passed on to SAS, strip the first line, and invoke SAS
Charming man. I wish I had a daughter so I could forbid her to marry one...