I want to have my SAS Enterprise Guide process send out an email if the process breaks down in any place. There are currently 12 individual steps in this process, and sometimes I get timeout issues when larger datasets get pulled in.
I've tried to do something like this to look for errors, but I'm not sure if it's possible to make it actually work:
%MACRO error_email;
%if &syscc > 0 %then %do;
FILENAME OUTBOX EMAIL;
DATA _NULL_;
...Basically, I want something like this to execute, but only if there is an error in one of the steps (the following code runs at the end once everything completes correctly):
FILENAME OUTBOX EMAIL;
DATA _NULL_;
FILE OUTBOX
TO = ("[email protected]")
FROM = ("[email protected]")
CC = ("[email protected]")
SUBJECT = "Process Name Process Completion"
ATTACH = ("&logs_out.Counts_And_Stats.html"
"&logs_out.Project_Name_Project_Log.txt"
"&logs_out.Project_Name_Tables_Produced.txt");
FILE OUTBOX;
PUT "The super-awesome-fancy-pants process has completed.";
PUT "Please find high-level statistics and the system log attached in this email.";
PUT "For questions regarding this report, please reach out to your local human.";
PUT " ";
PUT "Thank you";
RUN;Has anyone got experience with something like this?
You, or your admin, might want to check out the KEEPALIVE setting to avoid those timeouts you are experiencing:
Otherwise, it looks like your code should work and would be simplified if it was possible to have all 12 steps in one program object so that you could test for an error condition after each step.
Another method to consider, EG has a Conditional 'task' in the process flow window (right-click on a program node for example to see the option) that allows you to re-direct processing based on a condition.
Regards,
Bill
It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.