<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Macro to Send Error Email Not Working in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-to-Send-Error-Email-Not-Working/m-p/676273#M36713</link>
    <description>&lt;P&gt;Yes, for example see&amp;nbsp;&lt;A href="https://support.sas.com/kb/35/553.html" target="_blank"&gt;https://support.sas.com/kb/35/553.html&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;-- you should resolve the warnings too to avoid issues.&amp;nbsp; Sometimes warnings are an indicator of a problem that could cause unexpected results, even if not a SAS error.&lt;/P&gt;</description>
    <pubDate>Wed, 12 Aug 2020 18:31:54 GMT</pubDate>
    <dc:creator>ChrisHemedinger</dc:creator>
    <dc:date>2020-08-12T18:31:54Z</dc:date>
    <item>
      <title>Macro to Send Error Email Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-to-Send-Error-Email-Not-Working/m-p/676148#M36707</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to send an email to some body about the status of the main SAS code execution, such that if any error occurs, it send an email and inform that. I used the following macro at the end of my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  %macro send_mail;
   filename mymail email 'ABC@gmail.com' subject='Status';
     %if &amp;amp;syscc&amp;gt;0 %then %do;
       data _null_;
         file mymail;
         put 'An ERROR has occurred in the code';
       run;
     %end;
     %else %do;
       data _null_;
         file mymail;
         put 'The job ran to completion';
       run;
     %end;
   %mend;
   %send_mail&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, it sends an error email (An ERROR has occurred in the code) even when there is no error in the main body of my code. Can you please let me know why it happens and how to resolve it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 13:30:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-to-Send-Error-Email-Not-Working/m-p/676148#M36707</guid>
      <dc:creator>sun538</dc:creator>
      <dc:date>2020-08-12T13:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to Send Error Email Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-to-Send-Error-Email-Not-Working/m-p/676222#M36710</link>
      <description>&lt;P&gt;Do you have any WARNINGs in the log?&amp;nbsp; SYSCC is set to 4 when there is a warning.&amp;nbsp; So if you want to flag just errors, try &amp;gt;4 for a check.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 16:18:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-to-Send-Error-Email-Not-Working/m-p/676222#M36710</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2020-08-12T16:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to Send Error Email Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-to-Send-Error-Email-Not-Working/m-p/676228#M36711</link>
      <description>&lt;P&gt;The only thing you need to change is this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;put 'An ERROR has occurred in the code';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;put 'An ERROR or WARNING has occurred in the code';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Any run that ends with SYSCC ne 0 is not acceptable, and the code needs to be fixed, or any other cause (e.g. wrong input data, wrong time to start the code etc) straightened out.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 16:31:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-to-Send-Error-Email-Not-Working/m-p/676228#M36711</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-08-12T16:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to Send Error Email Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-to-Send-Error-Email-Not-Working/m-p/676247#M36712</link>
      <description>Many Thanks Chris. Yes, I have some warnings in the log. I changed it to &amp;amp;SYSCC &amp;gt;4 and works fine. Great. Thank you. So, there is no error type that set SYSCC a number between 0 and 4, is that correct?</description>
      <pubDate>Wed, 12 Aug 2020 17:22:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-to-Send-Error-Email-Not-Working/m-p/676247#M36712</guid>
      <dc:creator>sun538</dc:creator>
      <dc:date>2020-08-12T17:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to Send Error Email Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-to-Send-Error-Email-Not-Working/m-p/676273#M36713</link>
      <description>&lt;P&gt;Yes, for example see&amp;nbsp;&lt;A href="https://support.sas.com/kb/35/553.html" target="_blank"&gt;https://support.sas.com/kb/35/553.html&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;-- you should resolve the warnings too to avoid issues.&amp;nbsp; Sometimes warnings are an indicator of a problem that could cause unexpected results, even if not a SAS error.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 18:31:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-to-Send-Error-Email-Not-Working/m-p/676273#M36713</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2020-08-12T18:31:54Z</dc:date>
    </item>
  </channel>
</rss>

