labradorchik
asked on
How to run SAS program in UNIX Bash shell script?
I am trying to run .SAS program (test1.SAS) from Unix Bash shell script file. Please let me know what I am doing wrong in my Bash shell script or in my .SAS program code.
Note: SAS dataset "dataset1.sas7bdat" does exist in the "testing" directory in Unix.
Unix Bash shell script
SAS
Are there any other ways to run SAS programs (with SAS datasets) from Unix bash shell script?
Note: SAS dataset "dataset1.sas7bdat" does exist in the "testing" directory in Unix.
Unix Bash shell script
#script - tmp1.sh
#!/bin/bash
mydir=/2011/march/tuesday/testing
export mydir
sas=/products/SAS/SASFoundation/9.2/sas
$sas test1
exit
SAS
#filename test1.sas
libname lib "$mydir";
data lib.dataset2;
set lib.dataset1;
if _N_ < 10 then output;
run;
Are there any other ways to run SAS programs (with SAS datasets) from Unix bash shell script?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
no it won't work... that is a UNIX variable which you are trying to use in a SAS session...
like i mentioned in my other answer, that's AFAIK... i'll be glad if a fellow expert proves me wrong on this...
like i mentioned in my other answer, that's AFAIK... i'll be glad if a fellow expert proves me wrong on this...
ASKER
Thank you!!
ASKER
I will definitely try your way trigger SAS as well, but is it OK to reference "mydir" logical as I did in the test1.SAS?
Open in new window
Also, what if I want to reference a directory with a file (.SAS, .DAT, or .sas7bdat), would it logically work?
Thank you!