<?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: Dynamic E-mail in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-E-mail/m-p/326277#M271501</link>
    <description>&lt;P&gt;Yes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry my miskate, I made some changes to the ods file statement so I could test it here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Replace:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;ods html file=&lt;STRONG&gt;'location\xpto.txt'&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;ods html file=&lt;STRONG&gt;temp&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Daniel Santos&amp;nbsp;@ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 20 Jan 2017 14:15:21 GMT</pubDate>
    <dc:creator>DanielSantos</dc:creator>
    <dc:date>2017-01-20T14:15:21Z</dc:date>
    <item>
      <title>Dynamic E-mail</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-E-mail/m-p/326001#M271492</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to setup a dynamic e-mail.&lt;/P&gt;&lt;P&gt;So in my table&amp;nbsp;&lt;SPAN&gt;work.W4EHPWV I will have various info relating to particular users.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So I could have 5 different e-mails on 5 different lines.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Name &amp;nbsp; &amp;nbsp; &amp;nbsp; E-mail &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Info&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Test1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mail@test1.com &amp;nbsp; &amp;nbsp; &amp;nbsp;Hi&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Test2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mail@test2.com &amp;nbsp; &amp;nbsp; &amp;nbsp;Whats up&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can get this sending sigularly to the email below no problem, but what I would like is for the e-mail to be a variable and send on the info relating to the email address.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this makes sense, see below code to date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;filename temp email to="mail@test1.com"&lt;BR /&gt;type="text/html"&lt;BR /&gt;subject="TEST Daily Alert List";&lt;BR /&gt;ods html file=temp;&lt;BR /&gt;proc print data=work.W4EHPWV;&lt;BR /&gt;run;&lt;BR /&gt;ods html close;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Aidan&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2017 15:21:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamic-E-mail/m-p/326001#M271492</guid>
      <dc:creator>Aidan</dc:creator>
      <dc:date>2017-01-19T15:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic E-mail</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-E-mail/m-p/326047#M271493</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use a macro to cycle trhough, something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* send mail from DATA;
%macro mailit(DATA);

%let NOBS=0;
* get emails from DATA;
proc sql noprint;
select EMAIL into :EMAIL1- from &amp;amp;DATA;
select count(*) into :EMAILN from &amp;amp;DATA;
quit;

* cycle through emails;
%do I=1 %to &amp;amp;EMAILN;
 
filename temp email to="&amp;amp;&amp;amp;&amp;amp;EMAIL&amp;amp;I"
type="text/html"
subject="TEST Daily Alert List";
ods html file='d:\temp\xpto.txt';
proc print data=&amp;amp;DATA;
var INFO;
where EMAIL="&amp;amp;&amp;amp;&amp;amp;EMAIL&amp;amp;I";
run;
ods html close;

%end;

%mend mailit;

%mailit(W4EHPWV);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So first the emails are loaded into &lt;EM&gt;n&lt;/EM&gt; macro variables (EMAILn) and a cycle is performed for each.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Daniel Santos&amp;nbsp;@ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2017 16:53:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamic-E-mail/m-p/326047#M271493</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2017-01-19T16:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic E-mail</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-E-mail/m-p/326198#M271494</link>
      <description>&lt;P&gt;Thanks for your reply, I have tried this solution but am getting the below error.&lt;/P&gt;&lt;P&gt;ANy ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The e-mail address can be up to 255 long, should I substr() this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: Invalid macro parameter name &amp;amp;. It should be a valid SAS identifier no longer than 32 characters.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 07:54:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamic-E-mail/m-p/326198#M271494</guid>
      <dc:creator>Aidan</dc:creator>
      <dc:date>2017-01-20T07:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic E-mail</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-E-mail/m-p/326202#M271495</link>
      <description>&lt;P&gt;Hmmm. It shouldn't.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've tested the code with this sample, and works as expected:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data W4EHPWV;
input @1 TEST $13. @14 EMAIL $20. @34 INFO $8.;
datalines;
Test1        mail@test1.com      Hi      
Test2        mail@test2.com      Whats up
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What's the SAS version you are running there?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Daniel Santo&amp;nbsp;@ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 08:17:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamic-E-mail/m-p/326202#M271495</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2017-01-20T08:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic E-mail</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-E-mail/m-p/326203#M271496</link>
      <description>Version=4.901&lt;BR /&gt;&lt;BR /&gt;Maybe if I try trimming the email to the same length as what you have it could work, let me try that.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Jan 2017 08:21:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamic-E-mail/m-p/326203#M271496</guid>
      <dc:creator>Aidan</dc:creator>
      <dc:date>2017-01-20T08:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic E-mail</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-E-mail/m-p/326205#M271497</link>
      <description>Seems to be the line &amp;amp;DATA, should this be altered in any way? The source table is work.W9QRSD&lt;BR /&gt;&lt;BR /&gt;2431 %macro mailit(&amp;amp;DATA);&lt;BR /&gt;ERROR: Invalid macro parameter name &amp;amp;. It should be a valid SAS identifier no longer than 32 characters.&lt;BR /&gt;ERROR: A dummy macro will be compiled.</description>
      <pubDate>Fri, 20 Jan 2017 08:35:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamic-E-mail/m-p/326205#M271497</guid>
      <dc:creator>Aidan</dc:creator>
      <dc:date>2017-01-20T08:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic E-mail</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-E-mail/m-p/326206#M271498</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Shouldn't be necessary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;v4.901? Are you running the code through&amp;nbsp;SAS Data Integration Studio?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway,&amp;nbsp;run the following in a code window:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;proc product_status; run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It will list the your SAS/Base version, which was what I was asking for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Daniel Santos&amp;nbsp;@ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 08:35:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamic-E-mail/m-p/326206#M271498</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2017-01-20T08:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic E-mail</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-E-mail/m-p/326207#M271499</link>
      <description>&lt;P&gt;Well yes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;no &amp;amp; on DATA there, check the code I have posted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Daniel Santos&amp;nbsp;@ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 08:36:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamic-E-mail/m-p/326207#M271499</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2017-01-20T08:36:44Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic E-mail</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-E-mail/m-p/326273#M271500</link>
      <description>&lt;P&gt;My table just has a column called ALERT and EMAIL&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code is now executing without errors, but no e-mail is sending.&lt;/P&gt;&lt;P&gt;Code changes below, I have just removed the lcoation info;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;* send mail from DATA;&lt;BR /&gt;%macro mailit(DATA);&lt;/P&gt;&lt;P&gt;%let NOBS=0;&lt;BR /&gt;* get emails from DATA;&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select EMAIL into :EMAIL1- from &amp;amp;DATA;&lt;BR /&gt;select count(*) into :EMAILN from &amp;amp;DATA;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;* cycle through emails;&lt;BR /&gt;%do I=1 %to &amp;amp;EMAILN;&lt;BR /&gt;&lt;BR /&gt;filename temp email to="&amp;amp;&amp;amp;&amp;amp;EMAIL&amp;amp;I"&lt;BR /&gt;type="text/html"&lt;BR /&gt;subject="TEST Daily Alert List";&lt;BR /&gt;ods html file='location\xpto.txt';&lt;BR /&gt;proc print data=&amp;amp;DATA;&lt;BR /&gt;var ALERT;&lt;BR /&gt;where EMAIL="&amp;amp;&amp;amp;&amp;amp;EMAIL&amp;amp;I";&lt;BR /&gt;run;&lt;BR /&gt;ods html close;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%mend mailit;&lt;/P&gt;&lt;P&gt;%mailit(W9QRSD);&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 13:58:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamic-E-mail/m-p/326273#M271500</guid>
      <dc:creator>Aidan</dc:creator>
      <dc:date>2017-01-20T13:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic E-mail</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-E-mail/m-p/326277#M271501</link>
      <description>&lt;P&gt;Yes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry my miskate, I made some changes to the ods file statement so I could test it here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Replace:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;ods html file=&lt;STRONG&gt;'location\xpto.txt'&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;ods html file=&lt;STRONG&gt;temp&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Daniel Santos&amp;nbsp;@ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 14:15:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamic-E-mail/m-p/326277#M271501</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2017-01-20T14:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic E-mail</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-E-mail/m-p/326294#M271502</link>
      <description>Yes that is working now, if I have 15 rows of data it is sending 15 mails for each. Is there a way to limit this to 1 e-mail per 15 rows.&lt;BR /&gt;&lt;BR /&gt;I appreciate your patience and help so thank you</description>
      <pubDate>Fri, 20 Jan 2017 15:07:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamic-E-mail/m-p/326294#M271502</guid>
      <dc:creator>Aidan</dc:creator>
      <dc:date>2017-01-20T15:07:10Z</dc:date>
    </item>
  </channel>
</rss>

