<?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: ODS: Writing email body and HTML attachment in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ODS-Writing-email-body-and-HTML-attachment/m-p/91721#M19366</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; I suspect there may be some timing issues. Generally, I do this for an email and attach example (NOT email in the body of the document).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) create REPORT file in a separate step&lt;/P&gt;&lt;P&gt;2) issue FILENAME statement&lt;/P&gt;&lt;P&gt;3) use DATA step to send a brief message to initiate the email. This step is NOT inside an ODS "sandwich"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; See the example on page 7 of this paper: &lt;A href="http://support.sas.com/resources/papers/proceedings11/300-2011.pdf" title="http://support.sas.com/resources/papers/proceedings11/300-2011.pdf"&gt;http://support.sas.com/resources/papers/proceedings11/300-2011.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Since you are trying to put the SAME report as an attachment and in the body of the email, you may be confusing ODS. EG just adds a layer of complexity, because EG will&amp;nbsp; be trying to make report output for you too. If you don't get this resolved yourself, then you might want to work with Tech Support on this question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Dec 2012 03:18:42 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2012-12-06T03:18:42Z</dc:date>
    <item>
      <title>ODS: Writing email body and HTML attachment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ODS-Writing-email-body-and-HTML-attachment/m-p/91720#M19365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm attempting to create an email report which includes the results in the email body, and as a HTML attachment. At the moment I'm using a pair of ODS HTML statements and a 'filename email' statement. The code works, but I'm running it through Enterprise Guide 4.1, and it never actually ends until I force it to. The log reports no errors, and if I add anything extra after the email is sent that'll also run fine; Enterprise Guide just doesn't seem to realise that it's reached the end. If I replace the HTML attachment with any other kind the issue goes away, but I'd prefer to keep the attachment as HTML.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's a cut-down version of the code, which should demonstrate the problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;/* Just make a sample table */&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;PROC SQL;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; CREATE TABLE extfile AS&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; SELECT * FROM SASHELP.VEXTFL;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;QUIT;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;ods html(id=rpout) body="report.html";&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN&gt;filename doemail email to=("&lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:example@place.com"&gt;example@place.com&lt;/A&gt;&lt;SPAN&gt;")&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; type='TEXT/HTML'&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; subject="Test"&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN&gt;&amp;nbsp; from= "&lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:example@place.com"&gt;example@place.com&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; attach= ("report.html");&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;ods html body=doemail ENCODING='utf-8';&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;PROC PRINT DATA=WORK.extfile;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; VAR fileref xpath xengine;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;RUN;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;ods html(id=rpout) close;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;ods html close;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;Does anyone have any idea what might be causing this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Dec 2012 23:23:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ODS-Writing-email-body-and-HTML-attachment/m-p/91720#M19365</guid>
      <dc:creator>JCatling</dc:creator>
      <dc:date>2012-12-05T23:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: ODS: Writing email body and HTML attachment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ODS-Writing-email-body-and-HTML-attachment/m-p/91721#M19366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; I suspect there may be some timing issues. Generally, I do this for an email and attach example (NOT email in the body of the document).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) create REPORT file in a separate step&lt;/P&gt;&lt;P&gt;2) issue FILENAME statement&lt;/P&gt;&lt;P&gt;3) use DATA step to send a brief message to initiate the email. This step is NOT inside an ODS "sandwich"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; See the example on page 7 of this paper: &lt;A href="http://support.sas.com/resources/papers/proceedings11/300-2011.pdf" title="http://support.sas.com/resources/papers/proceedings11/300-2011.pdf"&gt;http://support.sas.com/resources/papers/proceedings11/300-2011.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Since you are trying to put the SAME report as an attachment and in the body of the email, you may be confusing ODS. EG just adds a layer of complexity, because EG will&amp;nbsp; be trying to make report output for you too. If you don't get this resolved yourself, then you might want to work with Tech Support on this question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Dec 2012 03:18:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ODS-Writing-email-body-and-HTML-attachment/m-p/91721#M19366</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2012-12-06T03:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: ODS: Writing email body and HTML attachment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ODS-Writing-email-body-and-HTML-attachment/m-p/91722#M19367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Cynthia. I've just spotted &lt;A _jive_internal="true" href="https://communities.sas.com/message/20668#20668"&gt;this discussion&lt;/A&gt;, which looks like a very similar problem. However, the solutions listed there did not work in my case (and my problem does not trigger unless I have both HTML destinations open at once). Seems like it's probably an EG problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was able to get around the problem by writing my report inside an ODS Document 'sandwich', and then using PROC DOCUMENT to replay it separately for each destination. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2012 01:10:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ODS-Writing-email-body-and-HTML-attachment/m-p/91722#M19367</guid>
      <dc:creator>JCatling</dc:creator>
      <dc:date>2012-12-07T01:10:58Z</dc:date>
    </item>
  </channel>
</rss>

