"it's imho a brute force approach which fights the symptoms and not the cause." @Patrick I agree it's a brute force approach because I don't know a lot of error handling in SAS and I don't know the functions you mentioned. But I created a separate job just for sending the email, and since sending the email isn't an essential part of the process, I guarantee that the chain of events isn't stopped by any problems related to sending the email and this way I still get the error report. I wasn't the one writting the code for sending the email, but here it is in case you or anyone has a idea for a more clean solution: %macro envia_email;
%let datetime_var = %sysfunc(time(),hhmm.);
%let RC2=%eval(&SYSERR);
%let RC1=%eval(&SYSRC);
%IF &RC1=0 AND &RC2=0 %then %DO;
FILENAME Mailbox EMAIL
TO=(&VAR_GALILEU_EMAIL_LIST.)
Subject="PTC | &VAR_GLOBAL_AMBIENTE. | PDS da cadeia &VAR_ODATE_CHAR. "
attach=(&File content_type="application/xlsx");
DATA _NULL_;
FILE Mailbox;
PUT "Segue em anexo o ficheiro do PDS.";
PUT " ";
PUT " ";
PUT "Não responda a este email";
PUT "----------------------------------Auto-reply-----------------------------------------------";
RUN;
%END;
%mend envia_email;
%envia_email;
... View more