<?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: Need help sending text messages from data step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-help-sending-text-messages-from-data-step/m-p/93529#M19706</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why not just split the email as a separate step from the merge?&lt;/P&gt;&lt;P&gt;You could then use macro logic or other code generation methods to only send an email when new items are found.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let anynew=0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data new_errors;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; merge out.known_errors (in=in1) errors (in=in2);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; by cust_id;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; if not in1 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; call symput('anynew','1');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%if &amp;amp;anynew %then %do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; filename mymail email "&lt;A class="jive-link-email-small" href="mailto:xxxxxxxx@txt.att.net"&gt;xxxxxxxx@txt.att.net&lt;/A&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; subject="CustomerIDs with potential errors" lrecl=256&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set new_errors ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file mymail dsd ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put custid @@;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%end;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 29 Jul 2013 11:51:16 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2013-07-29T11:51:16Z</dc:date>
    <item>
      <title>Need help sending text messages from data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-sending-text-messages-from-data-step/m-p/93528#M19705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I recently learned how to send emails/texts with SAS, and now I'm trying to put that knowledge to use in a data step.&amp;nbsp; Basically, I want to send myself a text mesaage with a list of CustomerIDs that have errors.&amp;nbsp; I have code that checks for errors and want to receive a text only when new CustomerIDs appear in the "error" data set.&amp;nbsp; Here's the code that I'm currently using:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Top of program:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;options emailsys=smtp emailauthprotocol=login emailid="&lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:xxxxxx@aol.com"&gt;xxxxxx@aol.com&lt;/A&gt;&lt;SPAN&gt;" emailpw="xxxxxxxx" &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;emailhost=smtp.aol.com&amp;nbsp; emailport=587;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code within macro:&lt;/P&gt;&lt;P&gt;DATA NEW_ERRORS;&lt;/P&gt;&lt;P&gt;MERGE OUT.KNOWN_ERRORS (IN=IN1) ERRORS (IN=IN2);&lt;/P&gt;&lt;P&gt;BY CUST_ID;&lt;/P&gt;&lt;P&gt;IF IN2 &amp;amp; NOT IN1 THEN DO;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OUTPUT NEW_ERRORS;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; filename mymail email "xxxxxxxx@&lt;SPAN style="color: #333333; font-family: Arial, sans-serif;"&gt;txt.att.net&lt;/SPAN&gt;" subject="CustomerIDs with potential errors" lrecl=256;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file mymail;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put 'list of CustomerIDs with errors separated by commas or spaces.';&amp;nbsp; *Still need to figure out this part!;&lt;/P&gt;&lt;P&gt;END;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;proc append base=OUT.KNOWN_ERRORS data=NEW_ERRORS FORCE;&lt;/P&gt;&lt;P&gt;proc sort data = OUT.KNOWN_ERRORS; BY CUST_ID; RUN; *NEED TO SORT DATA FOR SUBSEQUENT MERGES;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I'm attempting to with the above is take the list of errors over all CustomerIDs (ERRORS) and compare them with the currently known list of CustomerIDs with errors (OUT.KNOWN_ERRORS).&amp;nbsp; If there's a new set of CustomerIDs with an errors I want to 1) receive a text message with only that list of CustomerIDs (new errors) and 2) add those CustomerIDs to the currently known list of errors (OUT.KNOWN_ERRORS).&amp;nbsp; This way when the code is run again, I won't receive another text with the same list of CustomerIDs.&amp;nbsp; Note code works fine in terms of identifying and adding only the new errors to the known list of errors.&amp;nbsp; The issue I'm having is debugging the text message part.&amp;nbsp; When I run the code with no new CustomerIDs added to the list, I get constantly bombarded with text messages.&amp;nbsp; Therefore my DO statement isn't firing the text message code appropriately.&amp;nbsp; Does anyone have any suggestion as to what I'm doing wrong?&amp;nbsp; Am I trying to do&amp;nbsp; too much in one data step?&amp;nbsp; Also, does anyone know how to include the list of new CustomerIDs in the body of my text?&amp;nbsp; I was hoping to do this in a list format with each CustomerID separated by commas or spaces.&amp;nbsp; How would I create such a list?&amp;nbsp; As output to my log?&amp;nbsp; Or do I need to create some sort of macro variable that'll be used in an ODS statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help or advice would be greatly appreciated.&amp;nbsp; Thank you very much!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Bill&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2013 07:54:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-sending-text-messages-from-data-step/m-p/93528#M19705</guid>
      <dc:creator>BillJones</dc:creator>
      <dc:date>2013-07-29T07:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: Need help sending text messages from data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-sending-text-messages-from-data-step/m-p/93529#M19706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why not just split the email as a separate step from the merge?&lt;/P&gt;&lt;P&gt;You could then use macro logic or other code generation methods to only send an email when new items are found.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let anynew=0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data new_errors;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; merge out.known_errors (in=in1) errors (in=in2);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; by cust_id;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; if not in1 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; call symput('anynew','1');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%if &amp;amp;anynew %then %do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; filename mymail email "&lt;A class="jive-link-email-small" href="mailto:xxxxxxxx@txt.att.net"&gt;xxxxxxxx@txt.att.net&lt;/A&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; subject="CustomerIDs with potential errors" lrecl=256&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set new_errors ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file mymail dsd ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put custid @@;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%end;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2013 11:51:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-sending-text-messages-from-data-step/m-p/93529#M19706</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-07-29T11:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: Need help sending text messages from data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-sending-text-messages-from-data-step/m-p/93530#M19707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My apologies for the delayed response.&amp;nbsp; &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Thanks so much for the above.&amp;nbsp; Your solution worked perfectly!!!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bill&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 00:27:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-sending-text-messages-from-data-step/m-p/93530#M19707</guid>
      <dc:creator>BillJones</dc:creator>
      <dc:date>2013-07-31T00:27:45Z</dc:date>
    </item>
  </channel>
</rss>

