How to set an environment variable in the SAS parent shell on UNIX


The following code demonstrates how to set an environment variable in SAS's parent shell when doing batch processing in UNIX:

From the UNIX shell:

export envar=$(sas myprog.sas)
echo $envar

Here are the contents of myprog.sas:

%let macrovar=SAS process is now complete;
data _null_;
   file stdout;
   put "&macrovar";

This example sets the environment variable "envar" to the phrase "SAS process is now complete".