<?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 Macro Variable for Email Address in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-for-Email-Address/m-p/110688#M22973</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have recently switched to Outlook as our e-mail system.&amp;nbsp; We also uses SAS to send SMTP e-mail messages.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I send an e-mail to 2 different people in the "to=" line?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Currently we use a macro variable to store the user address.&amp;nbsp; I think Outlook uses a semi-colon as the separator&amp;nbsp; to put between&lt;/P&gt;&lt;P&gt;the 2 addresses, but this becomes an invalid statement in SAS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We code&amp;nbsp; - &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;call symput('emailaddr',&lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:'name1@company.com"&gt;'name1@company.com&lt;/A&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:name2@company.com"&gt;name2@company.com&lt;/A&gt;&lt;SPAN&gt;')&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to define the variable, &lt;/P&gt;&lt;P&gt;and then use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt; FILE OUTBOX&lt;/TD&gt;&lt;TD&gt;to="&amp;amp;emailaddr"&amp;nbsp; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but this does not work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Jun 2013 13:05:51 GMT</pubDate>
    <dc:creator>OS2Rules</dc:creator>
    <dc:date>2013-06-18T13:05:51Z</dc:date>
    <item>
      <title>Macro Variable for Email Address</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-for-Email-Address/m-p/110688#M22973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have recently switched to Outlook as our e-mail system.&amp;nbsp; We also uses SAS to send SMTP e-mail messages.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I send an e-mail to 2 different people in the "to=" line?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Currently we use a macro variable to store the user address.&amp;nbsp; I think Outlook uses a semi-colon as the separator&amp;nbsp; to put between&lt;/P&gt;&lt;P&gt;the 2 addresses, but this becomes an invalid statement in SAS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We code&amp;nbsp; - &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;call symput('emailaddr',&lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:'name1@company.com"&gt;'name1@company.com&lt;/A&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:name2@company.com"&gt;name2@company.com&lt;/A&gt;&lt;SPAN&gt;')&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to define the variable, &lt;/P&gt;&lt;P&gt;and then use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt; FILE OUTBOX&lt;/TD&gt;&lt;TD&gt;to="&amp;amp;emailaddr"&amp;nbsp; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but this does not work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jun 2013 13:05:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-for-Email-Address/m-p/110688#M22973</guid>
      <dc:creator>OS2Rules</dc:creator>
      <dc:date>2013-06-18T13:05:51Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Variable for Email Address</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-for-Email-Address/m-p/110689#M22974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would try a space-delimited list of quoted email addresses, in parentheses i.e.&lt;/P&gt;&lt;PRE&gt;file outbox to=("mail1@company.com"&amp;nbsp; "mail2@company.com") ;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;--Q&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jun 2013 13:18:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-for-Email-Address/m-p/110689#M22974</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2013-06-18T13:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Variable for Email Address</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-for-Email-Address/m-p/110690#M22975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just a question, it doesnt look like you are dynamically making the macro variable for the address. If not why not just code directly to the to line? Also the semicolon (in the macro variable) after the macro variable is resolved is probably being read by SAS to end the coding line and thus creating syntax errors. As quentin points out, and if memory serves, spaces should work fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just some thoughts. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EJ&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jun 2013 13:45:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-for-Email-Address/m-p/110690#M22975</guid>
      <dc:creator>esjackso</dc:creator>
      <dc:date>2013-06-18T13:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Variable for Email Address</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-for-Email-Address/m-p/110691#M22976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try This code I hope it works for you I just tested it seems ok to me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%let to_list="&lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:mail1@server.com"&gt;mail1@server.com&lt;/A&gt;&lt;SPAN&gt;" "&lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:mail2@server.com"&gt;mail2@server.com&lt;/A&gt;&lt;SPAN&gt;";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;%let path=W:;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename myemail email to=(&amp;amp;to_list.)&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;cc="&lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:mail3@server.com"&gt;mail3@server.com&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;bcc="&lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:mail4@server.com"&gt;mail4@server.com&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;subject="Sending mail through SAS"&lt;/P&gt;&lt;P&gt;attach=("path.\SAS_Code.sas" "&amp;amp;path.\Copy of SAS_Code.sas")&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;file myemail;&lt;/P&gt;&lt;P&gt;put "Hi,Please find attached the two SAS Files.Thanks,Nishunk";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Nishunk&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jun 2013 07:33:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-for-Email-Address/m-p/110691#M22976</guid>
      <dc:creator>NishunkSaxena</dc:creator>
      <dc:date>2013-06-19T07:33:00Z</dc:date>
    </item>
  </channel>
</rss>

