<?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 Help with email code needed in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-with-email-code-needed/m-p/644567#M192541</link>
    <description>&lt;P&gt;I am running SAS in a Unix environment. I am attempting to do a grep of the errors in the directory containing all of my SAS logs, place the results in a macro variable, and include the results in the body of an email. The code works, but the output in the body of the email only includes the first 2 lines out of several (around 20 or more) produced by the grep command.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What can I change in order to have my email body include ALL of the lines produced by the grep command? Please reply with examples. Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data _null_;
infile "cd /err/kept/here/;grep ERROR: *.log" pipe truncover;
length x $300.;
input x $300.;
call symputx('errors',x);
run;

FILENAME Mailbox EMAIL
	 SUBJECT="Email Containing Errors in SAS Code"
         content_type="TEXT/PLAIN";

data _null_;
file Mailbox TO='&amp;lt;myemailadr@yahoo.com&amp;gt;';
put "Here are today's errors:";
put "&amp;amp;errors.";
run;&lt;/PRE&gt;</description>
    <pubDate>Fri, 01 May 2020 17:50:50 GMT</pubDate>
    <dc:creator>ijm_wf</dc:creator>
    <dc:date>2020-05-01T17:50:50Z</dc:date>
    <item>
      <title>Help with email code needed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-email-code-needed/m-p/644567#M192541</link>
      <description>&lt;P&gt;I am running SAS in a Unix environment. I am attempting to do a grep of the errors in the directory containing all of my SAS logs, place the results in a macro variable, and include the results in the body of an email. The code works, but the output in the body of the email only includes the first 2 lines out of several (around 20 or more) produced by the grep command.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What can I change in order to have my email body include ALL of the lines produced by the grep command? Please reply with examples. Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data _null_;
infile "cd /err/kept/here/;grep ERROR: *.log" pipe truncover;
length x $300.;
input x $300.;
call symputx('errors',x);
run;

FILENAME Mailbox EMAIL
	 SUBJECT="Email Containing Errors in SAS Code"
         content_type="TEXT/PLAIN";

data _null_;
file Mailbox TO='&amp;lt;myemailadr@yahoo.com&amp;gt;';
put "Here are today's errors:";
put "&amp;amp;errors.";
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 May 2020 17:50:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-email-code-needed/m-p/644567#M192541</guid>
      <dc:creator>ijm_wf</dc:creator>
      <dc:date>2020-05-01T17:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: Help with email code needed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-email-code-needed/m-p/644570#M192544</link>
      <description>&lt;P&gt;Currently you are placing all of the output into a single macro variable.&lt;/P&gt;
&lt;P&gt;I am going to guess that the result you see if from the "last" set of errors. With the single macro variable each log file read is going to overwrite the macro variable and the result is only from the last file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would create an actual data set instead of the DATA _NULL_ to collect the output. Then you have some data to examine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And use that data set with PUT instead of macro variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2020 17:59:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-email-code-needed/m-p/644570#M192544</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-01T17:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: Help with email code needed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-email-code-needed/m-p/644579#M192553</link>
      <description>Thanks for replying. Could you please provide an example illustrating what you are suggesting? For instance, should do I need to change both of the data _null_ 's to data sets or only the first one?</description>
      <pubDate>Fri, 01 May 2020 18:11:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-email-code-needed/m-p/644579#M192553</guid>
      <dc:creator>ijm_wf</dc:creator>
      <dc:date>2020-05-01T18:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: Help with email code needed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-email-code-needed/m-p/644586#M192557</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe try like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;FILENAME Mailbox EMAIL
	 SUBJECT="Email Containing Errors in SAS Code"
         content_type="TEXT/PLAIN";

data _null_;
  file Mailbox TO='&amp;lt;myemailadr@yahoo.com&amp;gt;';
  if _N_=1 then put "Here are today's errors:";

  infile "cd /err/kept/here/;grep ERROR: *.log" pipe truncover;
  length x $300.;
  input x $300.;
  put x;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;All the best&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2020 19:03:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-email-code-needed/m-p/644586#M192557</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2020-05-01T19:03:49Z</dc:date>
    </item>
  </channel>
</rss>

