%SYSGET and export, why does import does not work?

Reply
Contributor
Posts: 40

%SYSGET and export, why does import does not work?

I use

"%SYSGET(variable)"

in sas code and

"export variable"

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?

 

Esteemed Advisor
Posts: 5,198

Re: %SYSGET and export, why does import does not work?

Contributor
Posts: 40

Re: %SYSGET and export, why does import does not work?

/*I am getting this in the log after running the shell script:*/

Null message body; hope that's ok

 

 

/*This is my SAS code*/

data _null_;

set sasperm.processlog;

STATUS = "InComplete";

if taskid=5000 and datepart(taskloggeddatetime)=today() and tasklaststatus="Complete" then

call symputx('STATUS', Tasklaststatus,'G');

else call symputx('STATUS', STATUS, 'G');

run;

 

data _null_;

file stdout;

put "&STATUS";

run;

 

 

/*This is my shell script part -- edited to remove any confidential details*/

 

export STATUS=$(sas /sasprograms/path/sasdatacheck.sas)

echo $STATUS

 

if [ "$STATUS" = "Complete" ]; then

mail -s "The data confirm process is complete"email@email.com

else

bsub /sasprograms/path/scripts/sasprogramETLs.ksh

fi

 

 

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.

 

Thanks!

Esteemed Advisor
Posts: 5,198

Re: %SYSGET and export, why does import does not work?

Sounds like another example of reinventing the weel. Use a proper scheduler instead.
Data never sleeps
Ask a Question
Discussion stats
  • 3 replies
  • 343 views
  • 3 likes
  • 2 in conversation