knowledge-database (beta)

Current group: comp.soft-sys.sas

Unix Script to execute SAS

Unix Script to execute SAS  
William Krause
 Re: Unix Script to execute SAS  
Richard A. DeVenezia
From:William Krause
Subject:Unix Script to execute SAS
Date:21 Jan 05 22:16:09 GMT
Do you have an example of a Unix Script that executes SAS and specifies the
path/filename in the script which will be written to by means of only the
fileref in the SAS program - file fileref; ? No filename statement will
be hardcoded in the SAS program will be specified. This is from a ksh
shell.

TIA

William Krause
wkrause2003@yahoo.com
From:Richard A. DeVenezia
Subject:Re: Unix Script to execute SAS
Date:Fri, 21 Jan 2005 17:50:36 -0500
William Krause wrote:
> Do you have an example of a Unix Script that executes SAS and
> specifies the path/filename in the script which will be written to by
> means of only the fileref in the SAS program - file fileref; ? No
> filename statement will be hardcoded in the SAS program will be
> specified. This is from a ksh shell.

I believe in Unix, you can also pipe a program to SAS for execution.
cat myProgam.sas | SAS -stdin

You can also use environment variables as automatic filerefs. (this works
in windows too)

DUDE_PGM is an automatic fileref in the SAS session.

dude.sas
---------
%put Hey dude;
---------

newdude.sas
---------
%put Hey new dude;
---------

rundude.sas
---------
%include DUDE_PGM;
---------

$ DUDE_PGM=dude.sas
$ SAS -sysin rundude

$ DUDE_PGM=newdude.sas
$ SAS -sysin rundude

So, same sas invocation can cause different things to happen when you make
the environment variables point to different things.

The Unix Companion has tons of really neat stuff in it. Recommended read.

--
Richard A. DeVenezia
http://www.devenezia.com/
   

Copyright © 2006 knowledge-database   -   All rights reserved