<?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: Counting the Number of Errors/Warnings in the SAS Log in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Counting-the-Number-of-Errors-Warnings-in-the-SAS-Log/m-p/931743#M44870</link>
    <description>&lt;P&gt;Have you explored the interactive "Send Email as a Step" feature in Enterprise Guide. You must use a Process Flow, right click on program -&amp;gt;&lt;/P&gt;
&lt;P&gt;Share -&amp;gt; Email as a step in the project.&amp;nbsp; Then &lt;STRONG&gt;uncheck&lt;/STRONG&gt; option to "Send even when errors occur in the files".&amp;nbsp; Note the "Add" button on the right in step 1 to choose the type of file you want to send from inside or outside of your project.&lt;/P&gt;
&lt;P&gt;You may want to turn on the global Project Log when using this feature.&amp;nbsp; See relevant screen captures below&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JOL_0-1718121176575.png" style="width: 491px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/97213iB01A9F5B495C63B4/image-dimensions/491x576?v=v2" width="491" height="576" role="button" title="JOL_0-1718121176575.png" alt="JOL_0-1718121176575.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JOL_1-1718121419327.png" style="width: 470px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/97216i6442403A4664AFE1/image-dimensions/470x348?v=v2" width="470" height="348" role="button" title="JOL_1-1718121419327.png" alt="JOL_1-1718121419327.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JOL_2-1718121803914.png" style="width: 831px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/97217iA58B160A81BE6EA2/image-dimensions/831x316?v=v2" width="831" height="316" role="button" title="JOL_2-1718121803914.png" alt="JOL_2-1718121803914.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/egcdc/8.4/egdoccdc/egug/p0sf4tl5ll1gfbn1voiyqguqqie1.htm" target="_blank"&gt;SAS Help Center: Using the Project Log&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Jun 2024 16:06:52 GMT</pubDate>
    <dc:creator>JOL</dc:creator>
    <dc:date>2024-06-11T16:06:52Z</dc:date>
    <item>
      <title>Counting the Number of Errors/Warnings in the SAS Log</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Counting-the-Number-of-Errors-Warnings-in-the-SAS-Log/m-p/931082#M44863</link>
      <description>&lt;P&gt;I'd like to write code that checks the SAS log for errors/warnings. If there are no errors/warnings throughout the code, I'd like to send an email with the results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am aware that something similar is possible in SAS Management Console, where an exit code is produced i.e. return code = 0 (success), return code = 1 (warning), return code = 2 (error).&amp;nbsp;In this particular example, I am not working with a batch process, and I'd like to customize the email that is sent to emails, so I'd like to perform this task in SAS Enterprise Guide. Recreating a customized version of the SAS Management Console return codes, and create logic that is only executed if the return code = 0, could be a good solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have come across SAS community posts utilizing the&amp;nbsp;syserr &amp;amp; syserrortext macro variables. However, I'm looking for an approach that checks an entire SAS program, as opposed to an error check after each individual data/proc step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe there's a way to read the SAS log file, count the number of occurences of the string 'ERROR:" and "WARNING:", and create a condition where code is performed where errors and warnings are equal to zero. Unfortunately, I couldn't find anything that worked for me online.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm thinking of something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;/*Email setup*/&lt;/DIV&gt;&lt;DIV&gt;filename outbox email&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;from = 'my.email@gmail.com'&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;to = 'your.email@gmail.com'&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;subject = "Results"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;attach = "C:\temp\results.csv"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;/*Send email if there are no errors/warnings*/&lt;/DIV&gt;&lt;DIV&gt;%macro error_check;&lt;/DIV&gt;&lt;DIV&gt;%if &amp;amp;number_of_errors. = 0 and &amp;amp;number_of_warnings. = 0 %then %do;&lt;/DIV&gt;&lt;DIV&gt;data _null_;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;file outbox;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;put "Hi,";&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;put ;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;put "Customized message to the relevant stakeholders.";&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;put ;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;put "Thanks,";&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;put "Josh";&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;run;&lt;/DIV&gt;&lt;DIV&gt;%end;&lt;/DIV&gt;&lt;DIV&gt;%mend;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;%error_check;&lt;/DIV&gt;</description>
      <pubDate>Thu, 06 Jun 2024 04:38:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Counting-the-Number-of-Errors-Warnings-in-the-SAS-Log/m-p/931082#M44863</guid>
      <dc:creator>joshkylepearce1</dc:creator>
      <dc:date>2024-06-06T04:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the Number of Errors/Warnings in the SAS Log</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Counting-the-Number-of-Errors-Warnings-in-the-SAS-Log/m-p/931743#M44870</link>
      <description>&lt;P&gt;Have you explored the interactive "Send Email as a Step" feature in Enterprise Guide. You must use a Process Flow, right click on program -&amp;gt;&lt;/P&gt;
&lt;P&gt;Share -&amp;gt; Email as a step in the project.&amp;nbsp; Then &lt;STRONG&gt;uncheck&lt;/STRONG&gt; option to "Send even when errors occur in the files".&amp;nbsp; Note the "Add" button on the right in step 1 to choose the type of file you want to send from inside or outside of your project.&lt;/P&gt;
&lt;P&gt;You may want to turn on the global Project Log when using this feature.&amp;nbsp; See relevant screen captures below&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JOL_0-1718121176575.png" style="width: 491px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/97213iB01A9F5B495C63B4/image-dimensions/491x576?v=v2" width="491" height="576" role="button" title="JOL_0-1718121176575.png" alt="JOL_0-1718121176575.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JOL_1-1718121419327.png" style="width: 470px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/97216i6442403A4664AFE1/image-dimensions/470x348?v=v2" width="470" height="348" role="button" title="JOL_1-1718121419327.png" alt="JOL_1-1718121419327.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JOL_2-1718121803914.png" style="width: 831px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/97217iA58B160A81BE6EA2/image-dimensions/831x316?v=v2" width="831" height="316" role="button" title="JOL_2-1718121803914.png" alt="JOL_2-1718121803914.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/egcdc/8.4/egdoccdc/egug/p0sf4tl5ll1gfbn1voiyqguqqie1.htm" target="_blank"&gt;SAS Help Center: Using the Project Log&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 16:06:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Counting-the-Number-of-Errors-Warnings-in-the-SAS-Log/m-p/931743#M44870</guid>
      <dc:creator>JOL</dc:creator>
      <dc:date>2024-06-11T16:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the Number of Errors/Warnings in the SAS Log</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Counting-the-Number-of-Errors-Warnings-in-the-SAS-Log/m-p/931745#M44871</link>
      <description>&lt;P&gt;Are you expecting to send the email as part of the same SAS run as the one that you are checking?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or do you plan to write a program that will scan the LOG of a previously run program and then produce the email?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 16:18:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Counting-the-Number-of-Errors-Warnings-in-the-SAS-Log/m-p/931745#M44871</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-06-11T16:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the Number of Errors/Warnings in the SAS Log</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Counting-the-Number-of-Errors-Warnings-in-the-SAS-Log/m-p/932071#M44872</link>
      <description>&lt;P&gt;The former. Currently, if the entire SAS project is run, an email is sent to stakeholders irrespective of whether there are code errors/warnings in earlier sections of the code. The goal is to put a control in place that checks whether any errors/warnings occur, in the same run, and only send the results via email if all code ran without errors/warnings.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 00:43:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Counting-the-Number-of-Errors-Warnings-in-the-SAS-Log/m-p/932071#M44872</guid>
      <dc:creator>joshkylepearce1</dc:creator>
      <dc:date>2024-06-13T00:43:49Z</dc:date>
    </item>
  </channel>
</rss>

