<?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 automate the email processing in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-the-email-processing/m-p/468134#M119544</link>
    <description>Data test;&lt;BR /&gt;Input id$ sales email$;&lt;BR /&gt;Cards;&lt;BR /&gt;aa 1000 xyz@gmail.com&lt;BR /&gt;bb 2000 raj@gmail.com&lt;BR /&gt;xx 9000 ggg@gmail.co;&lt;BR /&gt;Run;&lt;BR /&gt;&lt;BR /&gt;Can someone kindly help me on this request.&lt;BR /&gt;I want to send first line info(aa 1000) to xyz@gmail.com and same way 2nd line info(bb 2000) to raj@gmail.com etc..</description>
    <pubDate>Wed, 06 Jun 2018 17:12:55 GMT</pubDate>
    <dc:creator>Bhargavi221</dc:creator>
    <dc:date>2018-06-06T17:12:55Z</dc:date>
    <item>
      <title>How to automate the email processing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-the-email-processing/m-p/468134#M119544</link>
      <description>Data test;&lt;BR /&gt;Input id$ sales email$;&lt;BR /&gt;Cards;&lt;BR /&gt;aa 1000 xyz@gmail.com&lt;BR /&gt;bb 2000 raj@gmail.com&lt;BR /&gt;xx 9000 ggg@gmail.co;&lt;BR /&gt;Run;&lt;BR /&gt;&lt;BR /&gt;Can someone kindly help me on this request.&lt;BR /&gt;I want to send first line info(aa 1000) to xyz@gmail.com and same way 2nd line info(bb 2000) to raj@gmail.com etc..</description>
      <pubDate>Wed, 06 Jun 2018 17:12:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-the-email-processing/m-p/468134#M119544</guid>
      <dc:creator>Bhargavi221</dc:creator>
      <dc:date>2018-06-06T17:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to automate the email processing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-the-email-processing/m-p/468217#M119564</link>
      <description>&lt;P&gt;Here's what worked for me. Of course, double check your lengths on your cards on the email input.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; Data test;
Input id$ sales email$33.;
Cards;
aa 1000 aaa@gmail.com
bb 2000 bbb@gmail.com
xx 9000 xxx@gmail.com
;
Run;
FILENAME outmail EMAIL /* Use filename and define outmail variable */
SUBJECT="TEST"	/* Email title */
FROM= "sender@domain.com"; /*Who from*/
options mprint mlogic symbolgen;
%macro email();
%let cnt=1;
	%do %until(&amp;amp;cnt &amp;gt; &amp;amp;sysnobs); /*do until the cnt is gt # of obs in your dataset*/
data _null_;  /*creates variables from your dataset for obs=cnt*/
set test (firstobs=&amp;amp;cnt obs=&amp;amp;cnt);
call symputx('id',id);
call symputx('sales',put(sales,dollar12.2));
call symputx('email',email);
run;
data _null_; /*send the email. play around with the put statements as needed.*/
file outmail TO=("&amp;amp;email");
put "&amp;amp;id  &amp;amp;sales";
run;
%let cnt = %eval(&amp;amp;cnt + 1); /*increments the count up 1*/
	%end;
%mend email;
%email&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 23:23:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-the-email-processing/m-p/468217#M119564</guid>
      <dc:creator>bobpep212</dc:creator>
      <dc:date>2018-06-06T23:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to automate the email processing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-the-email-processing/m-p/468218#M119565</link>
      <description>&lt;P&gt;Searching the web for 30 seconds &lt;A href="http://support.sas.com/documentation/cdl/en/hostunx/61879/HTML/default/viewer.htm#email.htm" target="_self"&gt;brings up this:&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;filename reports email 'Jim';

data _null_;
  file reports;
  infile cards eof=lastobs;
  length name dept $ 21;
  input name dept;

     /* Assign the TO attribute      */
  put '!EM_TO!' name;
   
     /* Assign the SUBJECT attribute */
  put '!EM_SUBJECT! Report for ' dept;  
   
  put name ',';
  put 'Here is the latest report for ' dept '.';

     /* ATTACH the appropriate report */
  if dept='marketing' then
      put '!EM_ATTACH! mktrept.txt';
  else                                  
    
    put '!EM_ATTACH! devrept.txt';
  
     /* Send the message */
  put '!EM_SEND!';                      
    
    /* Clear the message attributes */
  put '!EM_NEWMSG!';                    
    
  return;

   /* Abort the message before the */ 
   /*   RUN statement causes it to */ 
   /*   be sent again.            */
lastobs: put '!EM_ABORT!';              
    
  datalines;
Susan          marketing
Jim            marketing
Rita           development
Herb           development
;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 23:29:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-the-email-processing/m-p/468218#M119565</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-06-06T23:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to automate the email processing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-the-email-processing/m-p/471331#M120715</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data test;
infile cards dlm=" ";
Input id$ sales email$ 40.;
Cards;
aa 1000 xyz@gmail.com
bb 2000 raj@gmail.com
xx 9000 ggg@gmail.com
;

proc sql;
select count(distinct email) into :emailcnt from test;
%let emailcnt = %cmpres(&amp;amp;emailcnt);
select distinct email into :email1 - :email&amp;amp;emailcnt from test;
quit;

%macro mail;
%if &amp;amp;emailcnt gt 0 %then
%do i = 1 %to &amp;amp;emailcnt;
filename Madhu email
from = "Insert User Email Id Here"
subject = "Test"
to = "&amp;amp;&amp;amp;email&amp;amp;i"
type = "text/html";

data _null_;
file Madhu;
set Test(where = (email="&amp;amp;&amp;amp;email&amp;amp;i"));
put ID SALES ;
RUN;
%end;
%mend;
%mail;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Jun 2018 10:34:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-the-email-processing/m-p/471331#M120715</guid>
      <dc:creator>MadhuKorni</dc:creator>
      <dc:date>2018-06-19T10:34:52Z</dc:date>
    </item>
  </channel>
</rss>

