<?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: How to send an email in SAS using &amp;quot;TO&amp;quot; email address as a macro variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-send-an-email-in-SAS-using-quot-TO-quot-email-address-as/m-p/582885#M165865</link>
    <description>&lt;P&gt;The code above is replicated (I changed the sasadmin to sasadmin1) but in the original code use SASADMIN and create SASADMIN. I did this to de-identify the actual email address of the recipients of the email but still be able to provide you with sample code that matches the original.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Aug 2019 16:23:44 GMT</pubDate>
    <dc:creator>zdeb15</dc:creator>
    <dc:date>2019-08-21T16:23:44Z</dc:date>
    <item>
      <title>How to send an email in SAS using "TO" email address as a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-send-an-email-in-SAS-using-quot-TO-quot-email-address-as/m-p/582836#M165848</link>
      <description>&lt;P&gt;I am using SAS metadata to create a SAS macro called &amp;amp;SASAdmin....This macro will be used to store all the sas admin email address so I can send an email to all the SASAdmins. I want to dynamically set the value so I don't have to constantly manage the "TO" email address if an employee leaves or a new employee is hired. This code works if in the TO: line is hard coded such as&lt;/P&gt;&lt;P&gt;' 'email1@test.org "email2@test.org" '&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but does not work if i put&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TO&amp;nbsp; "&amp;amp;SASAdmin"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code is below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;options emailsys=smtp emailhost=smtp.test.org emailport=25;&lt;BR /&gt;FILENAME output EMAIL&lt;BR /&gt;SUBJECT= "SAS PROGRAM ERROR"&lt;BR /&gt;FROM= "test@test.org"&lt;BR /&gt;TO= "&amp;amp;SASAdmin"&lt;BR /&gt;importance='high'&lt;BR /&gt;CT= "text/html" /* Required for HTML output*/;&lt;BR /&gt;ODS HTML BODY=output STYLE=minimal;&lt;BR /&gt;title "&amp;lt;div align='Center' style ='font-size:12pt'&amp;gt; SAS PROGRAM ERROR TEST&amp;lt;/div&amp;gt;";&lt;BR /&gt;footnote "&amp;lt;div style = 'font-size:10pt'&amp;gt; This E-mail is auto-generated from SAS on &amp;amp;sysday, &amp;amp;sysdate9.&amp;lt;/div&amp;gt;";&lt;BR /&gt;footnote2 "&amp;lt;div style = 'font-size:10pt'&amp;gt; on the &amp;amp;sysscp system using Release &amp;amp;sysver &amp;lt;/div&amp;gt;";&lt;/P&gt;&lt;P&gt;proc report data=enviromentspecs;&lt;BR /&gt;column programowner programpath lastruntime errortext;&lt;BR /&gt;define programowner / display;&lt;BR /&gt;define programprath / display;&lt;BR /&gt;define lastruntime / display;&lt;BR /&gt;define errortext / display;&lt;BR /&gt;label&lt;BR /&gt;programowner = 'Program Owner'&lt;BR /&gt;programpath = 'Program Path'&lt;BR /&gt;lastruntime = 'Program Last Run Time'&lt;BR /&gt;errortext = 'Program Error Text';&lt;BR /&gt;run;&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;errors:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR 23-2: Invalid option name SASAdmin.&lt;BR /&gt;ERROR: Error in the FILENAME statement.&lt;BR /&gt;ERROR: No logical assign for filename OUTPUT.&lt;BR /&gt;ERROR: No body file. HTML output will not be created.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 14:57:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-send-an-email-in-SAS-using-quot-TO-quot-email-address-as/m-p/582836#M165848</guid>
      <dc:creator>zdeb15</dc:creator>
      <dc:date>2019-08-21T14:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to send an email in SAS using "TO" email address as a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-send-an-email-in-SAS-using-quot-TO-quot-email-address-as/m-p/582850#M165854</link>
      <description>&lt;P&gt;How did you create the macro variable &amp;amp;sasadmin? Please show that piece of code.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 15:11:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-send-an-email-in-SAS-using-quot-TO-quot-email-address-as/m-p/582850#M165854</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-08-21T15:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to send an email in SAS using "TO" email address as a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-send-an-email-in-SAS-using-quot-TO-quot-email-address-as/m-p/582853#M165855</link>
      <description>Show the value of &amp;amp;SASADMIN.  Also include meaningful LOG output.</description>
      <pubDate>Wed, 21 Aug 2019 15:16:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-send-an-email-in-SAS-using-quot-TO-quot-email-address-as/m-p/582853#M165855</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2019-08-21T15:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to send an email in SAS using "TO" email address as a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-send-an-email-in-SAS-using-quot-TO-quot-email-address-as/m-p/582866#M165859</link>
      <description>&lt;P&gt;Replicated code below:&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;&lt;P&gt;data temp;&lt;BR /&gt;infile DATALINES;&lt;BR /&gt;length emailaddr $20.;&lt;BR /&gt;input keyid$ emailaddr$ displayname$;&lt;BR /&gt;CARDS;&lt;BR /&gt;1 test1@test.org test1&lt;BR /&gt;2 test2@test.org test2&lt;BR /&gt;3 test3@test.org test3&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;data temp1; set temp;&lt;/P&gt;&lt;P&gt;first = '"';&lt;BR /&gt;second = '"';&lt;/P&gt;&lt;P&gt;Email = catx('',first,emailAddr,second);&lt;BR /&gt;Email1 = compress(email);&lt;BR /&gt;TextList = 'NULL';&lt;BR /&gt;Team = 'SAS';&lt;BR /&gt;LastUpdateDt = datetime();&lt;BR /&gt;format LastUpdateDt datetime22.3;&lt;/P&gt;&lt;P&gt;run;&lt;BR /&gt;data temp2;&lt;/P&gt;&lt;P&gt;length emaillist $10000.;&lt;/P&gt;&lt;P&gt;do until (last.team);&lt;BR /&gt;set temp1;&lt;BR /&gt;by team notsorted;&lt;BR /&gt;emaillist=cats(emaillist,'',Email1);&lt;BR /&gt;end;&lt;BR /&gt;drop Email1 emailaddr first second email displayname keyid ;&lt;/P&gt;&lt;P&gt;run;&lt;BR /&gt;data _null_; set work.temp2;&lt;BR /&gt;call symput ('SASAdmin1',emaillist);&lt;BR /&gt;run;&lt;BR /&gt;%put sas admins are &amp;amp;SASAdmin1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LOG:&lt;/P&gt;&lt;P&gt;%put sas admins are &amp;amp;SASAdmin1;&lt;BR /&gt;sas admins are "test1@test.org""test2@test.org""test3@test.org"&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 15:33:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-send-an-email-in-SAS-using-quot-TO-quot-email-address-as/m-p/582866#M165859</guid>
      <dc:creator>zdeb15</dc:creator>
      <dc:date>2019-08-21T15:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to send an email in SAS using "TO" email address as a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-send-an-email-in-SAS-using-quot-TO-quot-email-address-as/m-p/582882#M165863</link>
      <description>&lt;P&gt;You create sasadmin&lt;STRONG&gt;1&lt;/STRONG&gt;, but try to use sysadmin.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 16:16:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-send-an-email-in-SAS-using-quot-TO-quot-email-address-as/m-p/582882#M165863</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-08-21T16:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to send an email in SAS using "TO" email address as a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-send-an-email-in-SAS-using-quot-TO-quot-email-address-as/m-p/582885#M165865</link>
      <description>&lt;P&gt;The code above is replicated (I changed the sasadmin to sasadmin1) but in the original code use SASADMIN and create SASADMIN. I did this to de-identify the actual email address of the recipients of the email but still be able to provide you with sample code that matches the original.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 16:23:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-send-an-email-in-SAS-using-quot-TO-quot-email-address-as/m-p/582885#M165865</guid>
      <dc:creator>zdeb15</dc:creator>
      <dc:date>2019-08-21T16:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to send an email in SAS using "TO" email address as a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-send-an-email-in-SAS-using-quot-TO-quot-email-address-as/m-p/582897#M165868</link>
      <description>&lt;P&gt;When the macro variable that contains&lt;/P&gt;
&lt;PRE&gt;"test1@test.org""test2@test.org""test3@test.org"&lt;/PRE&gt;
&lt;P&gt;is resolved in this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;TO= "&amp;amp;SASAdmin"&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you get&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;TO= ""test1@test.org""test2@test.org""test3@test.org""&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This can't work. A list of email recipients needs to be enclosed in parentheses (see the &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lestmtsglobal&amp;amp;docsetTarget=n0ig2krarrz6vtn1aw9zzvtez4qo.htm&amp;amp;locale=de" target="_blank" rel="noopener"&gt;documentation&lt;/A&gt;), so you should use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;TO=(&amp;amp;SASAdmin)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Aug 2019 16:58:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-send-an-email-in-SAS-using-quot-TO-quot-email-address-as/m-p/582897#M165868</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-08-21T16:58:44Z</dc:date>
    </item>
  </channel>
</rss>

