09-20-2015 09:59 PM
in sas code and
in shell script to transfer values for the variable from shell script to SAS code using some conditional statement for TEST and PROD servers.
I wanted to do the opposite, need to bring in a variable value from SAS table to shell script. I have the sas code that runs in the beginning of the shell script, the SAS code assign a value for one of the macros at the end. I wanted to use that macro value conditionally in the shell script to run specific things. I tried "import variable" in the shell script, but it does not work.
Can someone please tell me how to move values from SAS code to shell script?
09-21-2015 12:24 PM
/*I am getting this in the log after running the shell script:*/
Null message body; hope that's ok
/*This is my SAS code*/
STATUS = "InComplete";
if taskid=5000 and datepart(taskloggeddatetime)=today() and tasklaststatus="Complete" then
call symputx('STATUS', Tasklaststatus,'G');
else call symputx('STATUS', STATUS, 'G');
/*This is my shell script part -- edited to remove any confidential details*/
export STATUS=$(sas /sasprograms/path/sasdatacheck.sas)
if [ "$STATUS" = "Complete" ]; then
mail -s "The data confirm process is complete"firstname.lastname@example.org
I am trying to see if the data is ready in the first sas program using the process log table status. If they are ready then run those bunch of (17) ETL programs in the early morning. Since I don't want to do a sleep for several hours, I did not use the loops. The data load does not happen at the same time in the morning, but it is between 3 am to 6 am. But I want the ETL to be done by 8am, so several other reprots can use that data. ETL takes 2-3 hrs to finish. I am trying to schedule the shell script at 15 or 30 min interval from 3 am, so once the data is available ETL kicks in, that is why the conditional part is added in the shell script.