<?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: Send email with an email extracted from a table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Send-email-with-an-email-extracted-from-a-table/m-p/565337#M158709</link>
    <description>&lt;P&gt;An easy solution is to use a PROC SQL step to create a macro variable containing a list of values from a specific table.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA WORK.Have;
FORMAT 		emailaddr $50.; 
INFORMAT	emailaddr $50.; 
INPUT  		emailaddr; 
CARDS;      
AdamApple@gmail.com
BillBobington@yahoo.com
ChuckCooper@hotmail.com
;

PROC SQL NOPRINT;
	SELECT	CAT('"',STRIP(emailaddr),'"')	AS QtdEmail		INTO :EmailAddrList Separated by ' '
	FROM WORK.Have;
QUIT;

%PUT &amp;amp;=EmailAddrList.;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;When the new macro variable, 'EMAILADDRLIST' resolves, it looks like this (in the log):&lt;/P&gt;&lt;P&gt;EMAILADDRLIST="AdamApple@gmail.com" "BillBobington@yahoo.com" "ChuckCooper@hotmail.com"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So in your current logic, all you would then need to do is put a reference to this macro variable in the 'to' section. When it compiles, the macro variable will resolve to the list of email addresses (now in quotations), and then execute on that logic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Jun 2019 17:49:07 GMT</pubDate>
    <dc:creator>tsap</dc:creator>
    <dc:date>2019-06-11T17:49:07Z</dc:date>
    <item>
      <title>Send email with an email extracted from a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Send-email-with-an-email-extracted-from-a-table/m-p/565330#M158705</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to send an email as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;file sendit email&lt;BR /&gt;to=("&amp;amp;email_address")&lt;BR /&gt;subject="TEST";&lt;BR /&gt;put "Hello";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However I have to send for more than one email. E-mail addresses are in a table with email and group fields. Example:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;email&amp;nbsp; &amp;nbsp;group&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; X&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;X&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I want to extract from the table the emails that belong to the same group but I am only able to extract the first email (in this case A). &lt;/SPAN&gt;&lt;SPAN&gt;I have tried to create an array but when I put the array as the variable &amp;amp;email_address I can not send the mail.&amp;nbsp;The email addresses should look like this: "A" "B".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is there any way to parameterize the sending of the email so that the emails of the people to whom I want to send the mail are extracted from the table?&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you for your help!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 17:27:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Send-email-with-an-email-extracted-from-a-table/m-p/565330#M158705</guid>
      <dc:creator>susana_alves</dc:creator>
      <dc:date>2019-06-11T17:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: Send email with an email extracted from a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Send-email-with-an-email-extracted-from-a-table/m-p/565337#M158709</link>
      <description>&lt;P&gt;An easy solution is to use a PROC SQL step to create a macro variable containing a list of values from a specific table.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA WORK.Have;
FORMAT 		emailaddr $50.; 
INFORMAT	emailaddr $50.; 
INPUT  		emailaddr; 
CARDS;      
AdamApple@gmail.com
BillBobington@yahoo.com
ChuckCooper@hotmail.com
;

PROC SQL NOPRINT;
	SELECT	CAT('"',STRIP(emailaddr),'"')	AS QtdEmail		INTO :EmailAddrList Separated by ' '
	FROM WORK.Have;
QUIT;

%PUT &amp;amp;=EmailAddrList.;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;When the new macro variable, 'EMAILADDRLIST' resolves, it looks like this (in the log):&lt;/P&gt;&lt;P&gt;EMAILADDRLIST="AdamApple@gmail.com" "BillBobington@yahoo.com" "ChuckCooper@hotmail.com"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So in your current logic, all you would then need to do is put a reference to this macro variable in the 'to' section. When it compiles, the macro variable will resolve to the list of email addresses (now in quotations), and then execute on that logic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 17:49:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Send-email-with-an-email-extracted-from-a-table/m-p/565337#M158709</guid>
      <dc:creator>tsap</dc:creator>
      <dc:date>2019-06-11T17:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: Send email with an email extracted from a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Send-email-with-an-email-extracted-from-a-table/m-p/565546#M158807</link>
      <description>&lt;P&gt;Thank you for your help!&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 13:18:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Send-email-with-an-email-extracted-from-a-table/m-p/565546#M158807</guid>
      <dc:creator>susana_alves</dc:creator>
      <dc:date>2019-06-12T13:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: Send email with an email extracted from a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Send-email-with-an-email-extracted-from-a-table/m-p/565553#M158810</link>
      <description>&lt;P&gt;You're welcome&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 13:42:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Send-email-with-an-email-extracted-from-a-table/m-p/565553#M158810</guid>
      <dc:creator>tsap</dc:creator>
      <dc:date>2019-06-12T13:42:10Z</dc:date>
    </item>
  </channel>
</rss>

