<?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 add tables in SAS automatic email in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-tables-in-SAS-automatic-email/m-p/739253#M230708</link>
    <description>&lt;P&gt;Thank you!! I finally was able to test it and the code works wonderful!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 05 May 2021 16:28:05 GMT</pubDate>
    <dc:creator>coladuck</dc:creator>
    <dc:date>2021-05-05T16:28:05Z</dc:date>
    <item>
      <title>How to add tables in SAS automatic email</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-tables-in-SAS-automatic-email/m-p/686880#M208478</link>
      <description>&lt;P&gt;I am trying to add a data table into the automatic email I sent out using SAS.&lt;/P&gt;&lt;P&gt;I tried the solution code mentioned in&lt;A href="https://communities.sas.com/t5/SAS-Programming/how-to-create-an-automated-email-with-table-and-text-contents/td-p/319022" target="_self"&gt; this post&lt;/A&gt; and it creates an html file, which can open fine in the browser.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the email I received does not display the tables and instead, it seemed to wrote the html in the body.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename REPORT "&amp;amp;path\test.html";
filename SEND email to           = "xxx@xxx"
                    subject      = "test"
                    from         = "xxx@xxx"
                    content_type = "text/html";


ods html file=REPORT;
proc print data=SASHELP.CLASS(obs=2); run;
ods html close;

data _null_;
  infile REPORT;
  file SEND;
  input;
  if _infile_ ne '&amp;lt;/html&amp;gt;' then put _infile_;
  else do;
    put '&amp;lt;p&amp;gt;More text&amp;lt;/p&amp;gt;&amp;lt;/html&amp;gt;';
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and here is part of the email I received:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta name="Generator" content="SAS Software Version 9.4, see www.sas.com"&amp;gt;
&amp;lt;meta http-equiv="Content-type" content="text/html; charset=windows-1252"&amp;gt;
&amp;lt;title&amp;gt;SAS Output&amp;lt;/title&amp;gt;
&amp;lt;style type="text/css"&amp;gt;
&amp;lt;!--
.activelink
{
  color: #800080;
}
.aftercaption
{
  background-color: #FAFBFE;
  border-spacing: 0px;
  color: #112277;
  font-family: Arial, 'Albany AMT', Helvetica, Helv;
  font-size: x-small;
  font-style: normal;
  font-weight: bold;
  padding-top: 4pt;
}
.batch
{
  background-color: #FAFBFE;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Ideally, I would want something like:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dear xxx:&lt;/P&gt;&lt;P&gt;Here is the table for today:&lt;/P&gt;&lt;P&gt;&amp;lt;a table here which pull data from SAS dataset&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;xxx&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did I miss anything in the SAS code or setting? The html file from ods was created fine and I can open it to see the table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for your help!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Sep 2020 02:16:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-tables-in-SAS-automatic-email/m-p/686880#M208478</guid>
      <dc:creator>coladuck</dc:creator>
      <dc:date>2020-09-26T02:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to add tables in SAS automatic email</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-tables-in-SAS-automatic-email/m-p/686967#M208521</link>
      <description>&lt;P&gt;Please try this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options emailsys=smtp emailid ="sender_username@mydomain.com" emailpw=&amp;lt;masked&amp;gt; emailhost=smtphost emailport=&amp;lt;smtp_port&amp;gt; ;
title1 "&amp;lt;Add your title here otherwise it will default to The SAS System";
proc options group=email;
run;

FILEName Mailbox EMAIL 
To = ('Receiver1@domainA.com','Receiver2@domainB.com')
Subject="Your Subject"
Content_Type="text/html"
;

ODS html body=Mailbox style = noline;
ods html text = "Dear XXX," ;
ods html text = "Here is the table for today" ;
ods html text = "" ;


proc print data=SASHELP.CLASS(obs=2); run;

ods _all_ close;
title1;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Also here is the relevant SAS paper for additional flexibility:&amp;nbsp;&lt;A title="Sending e-mail from the DATA step" href="https://support.sas.com/resources/papers/proceedings/pdfs/sgf2008/038-2008.pdf" target="_blank" rel="noopener"&gt;https://support.sas.com/resources/papers/proceedings/pdfs/sgf2008/038-2008.pdf&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Sep 2020 22:26:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-tables-in-SAS-automatic-email/m-p/686967#M208521</guid>
      <dc:creator>IChatterji</dc:creator>
      <dc:date>2020-09-26T22:26:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to add tables in SAS automatic email</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-tables-in-SAS-automatic-email/m-p/739253#M230708</link>
      <description>&lt;P&gt;Thank you!! I finally was able to test it and the code works wonderful!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 May 2021 16:28:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-tables-in-SAS-automatic-email/m-p/739253#M230708</guid>
      <dc:creator>coladuck</dc:creator>
      <dc:date>2021-05-05T16:28:05Z</dc:date>
    </item>
  </channel>
</rss>

