LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2003, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 24 Feb 2003 10:58:40 -0800
Reply-To:   seeliger.curt@epa.gov
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Curt Seeliger <seeliger.curt@EPA.GOV>
Organization:   CSC/EPA WED
Subject:   Re: shebang notation on Unix...or cygwin?
In-Reply-To:   <20030224174928.GA6015@ganymede>
Content-Type:   text/plain; charset="iso-8859-1"

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 ~/bin/output/$SASPROG.lst /* test of sas via shebang */ libname test '/opt/data/strmsed/total/';

proc contents data=test.thalweg; run; ERROR: Libname TEST is not assigned.

NOTE: Statements not processed because of errors noted above. NOTE: PROCEDURE CONTENTS used: real time 0.00 seconds cpu time 0.01 seconds

NOTE: The SAS System stopped processing this step because of errors. NOTE: SAS set option OBS=0 and will continue to check statements. This may cause NOTE: No observations in data set.

data _null_; put "You *got* the whole shebang"; run;

NOTE: DATA statement used: real time 0.01 seconds cpu time 0.01 seconds

/* end of file */

Waah. Since most of my SAS scripts need to run in both batch and interactive modes, I use a csh script which boils down to the following:

/opt/bin/sas8/sas -noterminal \ -work /opt/bin/sas8/work/ \ -log $cwd/$SASPROG.log \ -print $cwd/$SASPROG.lst \ -set runmode COMMAND \ $cwd/$SASPROG.sas

-- Curt Seeliger, Data Ranger CSC, EPA/WED contractor 541/754-4638 seeliger.curt@epa.gov


Back to: Top of message | Previous page | Main SAS-L page