<?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 How To Sending E-mail With Error Rows From The Log File? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-To-Sending-E-mail-With-Error-Rows-From-The-Log-File/m-p/681876#M206327</link>
    <description>&lt;P&gt;Hello everybody,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I know that following code works for sending an e-mail, however I want to put error rows which starts with ERROR: from my log into the body of this e-mail. And I also want to attach the full log to the attachment of the mail. I think I can make it with the ATTACH statement.&amp;nbsp; But the main point is sending error rows into mail's body.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;FILENAME MYMAIL EMAIL;

DATA _NULL_;

FILE MYMAIL 
TO="tarik.birinci@ozu.edu.tr"
SUBJECT="%upcase(&amp;amp;SYSHOSTNAME) INFO";
PUT " Hello";

RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I prepared a log for you and it is in the attachment. If this kind of log file occurs, then I want to see the mail as below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My desired e-mail output as below. I will be glad if somebody help me about this issue.&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="sample_mail.png" style="width: 453px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49040iDC076A18D8193A4E/image-dimensions/453x223?v=v2" width="453" height="223" role="button" title="sample_mail.png" alt="sample_mail.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;</description>
    <pubDate>Sun, 06 Sep 2020 13:16:53 GMT</pubDate>
    <dc:creator>tarikbirinci1</dc:creator>
    <dc:date>2020-09-06T13:16:53Z</dc:date>
    <item>
      <title>How To Sending E-mail With Error Rows From The Log File?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-To-Sending-E-mail-With-Error-Rows-From-The-Log-File/m-p/681876#M206327</link>
      <description>&lt;P&gt;Hello everybody,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I know that following code works for sending an e-mail, however I want to put error rows which starts with ERROR: from my log into the body of this e-mail. And I also want to attach the full log to the attachment of the mail. I think I can make it with the ATTACH statement.&amp;nbsp; But the main point is sending error rows into mail's body.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;FILENAME MYMAIL EMAIL;

DATA _NULL_;

FILE MYMAIL 
TO="tarik.birinci@ozu.edu.tr"
SUBJECT="%upcase(&amp;amp;SYSHOSTNAME) INFO";
PUT " Hello";

RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I prepared a log for you and it is in the attachment. If this kind of log file occurs, then I want to see the mail as below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My desired e-mail output as below. I will be glad if somebody help me about this issue.&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="sample_mail.png" style="width: 453px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49040iDC076A18D8193A4E/image-dimensions/453x223?v=v2" width="453" height="223" role="button" title="sample_mail.png" alt="sample_mail.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;</description>
      <pubDate>Sun, 06 Sep 2020 13:16:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-To-Sending-E-mail-With-Error-Rows-From-The-Log-File/m-p/681876#M206327</guid>
      <dc:creator>tarikbirinci1</dc:creator>
      <dc:date>2020-09-06T13:16:53Z</dc:date>
    </item>
    <item>
      <title>Re: How To Sending E-mail With Error Rows From The Log File?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-To-Sending-E-mail-With-Error-Rows-From-The-Log-File/m-p/681896#M206340</link>
      <description>&lt;P&gt;Hey, Tarik! How about trying something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Set up a filreref pointing to the log file */
filename readme "&amp;amp;filepath/sample_log.txt";
&lt;BR /&gt;DATA _NULL_;
   /* If an error is never found, we don't want anything to happen */
   /* ErrorFound is a flag to remember if one has been found or not*/
   retain ErrorFound 0;
   infile readme;
   input;
   if find(_infile_,"ERROR") then do;
      /* There is an ERROR message startinin this line of the log */
      if not ErrorFound then do;
         /* This is the first ERROR found, so set up the email */
         FILE MYMAIL 
            TO="tarik.birinci@ozu.edu.tr"
            SUBJECT="%upcase(&amp;amp;SYSHOSTNAME) INFO"
         ;
         PUT " Hello";
      end;
      /* remember we've already found an ERROR */
      ErrorFound=1;
      /* Write the current LOG file line to the EMAIL file */
      put _infile_;
   end;
RUN;
filename mymail;
filename Readme;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;May the SAS be with you!&lt;BR /&gt;Mark&lt;/P&gt;</description>
      <pubDate>Sun, 06 Sep 2020 18:21:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-To-Sending-E-mail-With-Error-Rows-From-The-Log-File/m-p/681896#M206340</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2020-09-06T18:21:04Z</dc:date>
    </item>
  </channel>
</rss>

