<?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: Email ID's of 2 datasets in Email Body in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Email-ID-s-of-2-datasets-in-Email-Body/m-p/227009#M40875</link>
    <description>&lt;P&gt;Something like this should work. It was unclear from your example what filtering criteria should be used for good IDs (that transferred) and bad IDs (that did not transfer), so this example is generic.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
  SELECT DISTINCT id 
  INTO :good_id_list SEPARATED BY ", "
  FROM work.my_dataset1
  WHERE /* add filtering criteria for IDs that are good (transferred) */
  ;
QUIT;


PROC SQL;
  SELECT DISTINCT id 
  INTO :bad_id_list SEPARATED BY ", "
  FROM work.my_dataset2
  WHERE /* add filtering criteria for IDs that are bad (did not transfer) */
  ;
QUIT;


DATA _null_;
  file sendit email
    from="your_name@name_of_company.com"
    to=("recipient_name@name_of_company.com")
    cc=("courtesy_copy_name1@name_of_company.com"
        "courtesy_copy_name2@name_of_company.com"
        "courtesy_copy_name3@name_of_company.com")
    subject="&amp;amp;env. Records Transferred on %sysfunc(date(), yymmdd10.)"
    importance="High";

  if length(&amp;amp;bad_id_list) &amp;gt; 65500 then do;
    put "BEWARE: macro variable 'bad_id_list' exceeds maximum length of 64 kilobytes.";
    put "The list of IDs have been truncated.";
  end;
  if length(&amp;amp;good_id_list) &amp;gt; 65500 then do;
    put "BEWARE: macro variable 'good_id_list' exceeds maximum length of 64 kilobytes";
    put "The list of IDs have been truncated.";
  end;

  put "Below is a list of IDs that transfered:";
  put "=======================================";
  put &amp;amp;good_id_list;
  put "";
  put "";
  put "Below is a list of IDs that did not transfer:";
  put "=============================================";
  put &amp;amp;bad_id_list;
  put "";
  put "";
  put "Regards,";
  put "SAS guy";
  put;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 23 Sep 2015 22:49:30 GMT</pubDate>
    <dc:creator>hbi</dc:creator>
    <dc:date>2015-09-23T22:49:30Z</dc:date>
    <item>
      <title>Email ID's of 2 datasets in Email Body</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Email-ID-s-of-2-datasets-in-Email-Body/m-p/195598#M36809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; background-color: #ffffff;"&gt;I'm trying to send out ID's of 2 SAS datasets which has ID's that were transferred and ID's that failed to transfer in an email body as text but not able to get the format right. I just need plain text as html is getting stuck and slow.&amp;nbsp; Here is my current code but the ID's are missing after it reaches 32000.. I saw CATX takes only that but also when it is called through Macro it can take 64000 but since I'm new to SAS I'm not sure how to do it. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; background-color: #ffffff;"&gt;Please help and also let me know how to add the SAS dataset of ID's that were not processed after the text of ID's processed. &lt;BR /&gt;&lt;BR /&gt;&lt;CODE style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif;"&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;%&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;include &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;'/saswrk/go/scripts/envsetup.sas'&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&lt;BR /&gt;filename mymail email &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;"&amp;amp;emaillist"&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&amp;nbsp; subject &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;"&amp;amp;env. Records Transferred on %sysfunc(date(), yymmdd10.)"&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&lt;BR /&gt;data _null_&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&amp;nbsp; length id_list &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: #800000;"&gt;3000&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&amp;nbsp; retain id_list &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;''&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;set&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; workgo&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;recds_processed nobs &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; nobs &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;end&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; eof&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;file&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; mymail&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; _n_ &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: #800000;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;then&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; do&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&amp;nbsp; put &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;'Number of records processed='&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; nobs&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&amp;nbsp; put &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;'The IDs are:'&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;end&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="com" style="color: #808080;"&gt;/* Print the IDs in chunks */&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; length&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;strip&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;id_list&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;))&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: #800000;"&gt;2000&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;then&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; do&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&amp;nbsp; put id_list&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&amp;nbsp; call missing&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;id_list&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;);&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;end&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; call catx&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000;"&gt;', '&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; id_list&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; id&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;);&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; eof &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;then&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; put id_list&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;run&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 00:15:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Email-ID-s-of-2-datasets-in-Email-Body/m-p/195598#M36809</guid>
      <dc:creator>etl_tool</dc:creator>
      <dc:date>2015-05-29T00:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: Email ID's of 2 datasets in Email Body</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Email-ID-s-of-2-datasets-in-Email-Body/m-p/227009#M40875</link>
      <description>&lt;P&gt;Something like this should work. It was unclear from your example what filtering criteria should be used for good IDs (that transferred) and bad IDs (that did not transfer), so this example is generic.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
  SELECT DISTINCT id 
  INTO :good_id_list SEPARATED BY ", "
  FROM work.my_dataset1
  WHERE /* add filtering criteria for IDs that are good (transferred) */
  ;
QUIT;


PROC SQL;
  SELECT DISTINCT id 
  INTO :bad_id_list SEPARATED BY ", "
  FROM work.my_dataset2
  WHERE /* add filtering criteria for IDs that are bad (did not transfer) */
  ;
QUIT;


DATA _null_;
  file sendit email
    from="your_name@name_of_company.com"
    to=("recipient_name@name_of_company.com")
    cc=("courtesy_copy_name1@name_of_company.com"
        "courtesy_copy_name2@name_of_company.com"
        "courtesy_copy_name3@name_of_company.com")
    subject="&amp;amp;env. Records Transferred on %sysfunc(date(), yymmdd10.)"
    importance="High";

  if length(&amp;amp;bad_id_list) &amp;gt; 65500 then do;
    put "BEWARE: macro variable 'bad_id_list' exceeds maximum length of 64 kilobytes.";
    put "The list of IDs have been truncated.";
  end;
  if length(&amp;amp;good_id_list) &amp;gt; 65500 then do;
    put "BEWARE: macro variable 'good_id_list' exceeds maximum length of 64 kilobytes";
    put "The list of IDs have been truncated.";
  end;

  put "Below is a list of IDs that transfered:";
  put "=======================================";
  put &amp;amp;good_id_list;
  put "";
  put "";
  put "Below is a list of IDs that did not transfer:";
  put "=============================================";
  put &amp;amp;bad_id_list;
  put "";
  put "";
  put "Regards,";
  put "SAS guy";
  put;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Sep 2015 22:49:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Email-ID-s-of-2-datasets-in-Email-Body/m-p/227009#M40875</guid>
      <dc:creator>hbi</dc:creator>
      <dc:date>2015-09-23T22:49:30Z</dc:date>
    </item>
  </channel>
</rss>

