An article describing how to set up SAS to run in Cygwin shell scripts hosted at Data Savant Consulting:
Linking to SAS
Unix has got to find SAS, somehow, if you have SAS on your PC. You can add the directory with the sas executable (
sas.exe) to the end of thePATHlike this:
PATH=$PATH:/cygdrive/c/shellscripts:/cygdrive/c/PROGRA~1/SASINS~1/SAS/v8Note that because Unix will not accept spaces in directory names, you have to use the pure DOS notation for some of the directories. You can see that I have done this for “Program Files” and “SAS Institute”.
Running SAS in batch
Some of the shell scripts on this site run SAS in batch. It is supposed to be done discretely so that the user is not aware that they are running sas. In order to suppress the pop-up windows you get with PC sas then you can disable them using the following options:
sas -nosplash -nologo -iconWhen you call sas in one of your scripts then set these options to suppress the windows. I do not know of a shorthand way of doing this. There is no point setting up an alias in your .
bashrcas this will not get exported to any sub-processes like you get for a shell script.The second problem running SAS in batch is that it will have is locating the program files. Your PC sas will not understand the Unix directory structure. It will expect a DOS file name. The scripts I write that call SAS, generate program code in my home directory and then invokes SAS to run the code. I have set up a HOMEW variable in my
.bashrcand exported it so that I can use it in shell scripts.
HOMEW=C:cygwinhomeDefault
export HOMEWIn the shell script I then use
$HOMEWas both the destination of the log and to indicate where the program code is stored.
# Run the SAS code
sas -nosplash -nologo -icon -log "$HOMEW" -sysin "$HOMEWcontents.sas"If you are developing shell scripts that call SAS on your PC and they are intended eventually for a Unix platform then you have to change
$HOMEWto$HOMEand change the backslash to a forward slash in the program location. You may have to remove the “-nosplash -nologo -icon” options as well.
0 Comments.