<?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: Receiving 2 separate emails when trying to put email body in excel sheet generated using ODS in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Receiving-2-separate-emails-when-trying-to-put-email-body-in/m-p/286819#M16453</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The use this code sample, change excel to use tagsets.excelxp also changed the extension to XML.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename tmpxlsx temp;
ods tagsets.excelxp file=tmpxlsx options(sheet_name="Female");

proc print data=sashelp.class;
  where sex = "F";
run;

ods tagsets.excelxp options(sheet_name="Male");

proc print data=sashelp.class;
  where sex = "M";
run;

ods tagsets.excelxp close;

filename outbox email

  to='abc@def.com'

  from='abc@def.com'
  attach=(
    "%sysfunc(pathname(tmpxlsx))"
    name="someName"
    ct='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
    ext="xml"
  ) 

  subject='Sample First Program'
;

DATA _null_;
  file outbox;
  PUT 'Please find attached the report';
  PUT ' ';
  PUT 'Thankyou';
RUN;

filename tmpxlsx clear;
filename outbox clear;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
    <pubDate>Mon, 25 Jul 2016 11:23:13 GMT</pubDate>
    <dc:creator>BrunoMueller</dc:creator>
    <dc:date>2016-07-25T11:23:13Z</dc:date>
    <item>
      <title>Receiving 2 separate emails when trying to put email body in excel sheet generated using ODS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Receiving-2-separate-emails-when-trying-to-put-email-body-in/m-p/286804#M16448</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create an excel sheet using output of my 4 proc sql statements&amp;nbsp;&lt;/P&gt;
&lt;P&gt;then email it&amp;nbsp;&lt;/P&gt;
&lt;P&gt;add email body&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First 2 are working fine however when I am trying to put email body I am getting two different emails , my code is as follows:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sql&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;CREATE TABLE t1 AS&lt;/P&gt;
&lt;P&gt;select * from abc;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sql&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;CREATE TABLE t2 AS&lt;/P&gt;
&lt;P&gt;select * from def;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sql&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;CREATE TABLE t3 AS&lt;/P&gt;
&lt;P&gt;select * from ghi;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sql&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;CREATE TABLE t4 AS&lt;/P&gt;
&lt;P&gt;select * from jkl;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ods TAGSETS.EXCELXP body=outbox rs=none style=styles.HTMLBlue;&lt;/P&gt;
&lt;P&gt;ods TAGSETS.EXCELXP text="test sample text";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ods TAGSETS.EXCELXP rs=none OPTIONS(SHEET_NAME="abc");&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;print&lt;/STRONG&gt; data=t1 noobs;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ods TAGSETS.EXCELXP rs=none OPTIONS(SHEET_NAME="def");&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;print&lt;/STRONG&gt; data=t2 noobs;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ods TAGSETS.EXCELXP rs=none OPTIONS(SHEET_NAME="ghi");&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;print&lt;/STRONG&gt; data=t3 noobs;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ods TAGSETS.EXCELXP rs=none OPTIONS(SHEET_NAME="jkl");&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;print&lt;/STRONG&gt; data=t4 noobs;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;ods TAGSETS.EXCELXP close;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;filename outbox email&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; to='abc@abc.com'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from='def@def.com'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type='application/vnd.ms-excel'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; subject='Sample First Program';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt; _null_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PUT 'Please find attached the report';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PUT ' ';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PUT 'Thankyou';&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;RUN;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have seen so many similar threads but none of them are working for me. I tried ODS text , separate Data _null_ option, tried putting all into one filename option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please help in identifying the issue in this ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2016 09:42:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Receiving-2-separate-emails-when-trying-to-put-email-body-in/m-p/286804#M16448</guid>
      <dc:creator>PreenaKaur</dc:creator>
      <dc:date>2016-07-25T09:42:21Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving 2 separate emails when trying to put email body in excel sheet generated using ODS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Receiving-2-separate-emails-when-trying-to-put-email-body-in/m-p/286807#M16450</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First create the file that is used as an attachment to the email, this is what you did.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The DATA step that writes the body of the email, needs a FILE statement, so that the something is written to the body contents.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For SAS9.4 there is a EXCEL ODS destination that can be used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is sample code that will create an excel file to be used as the attachment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The DATA Step then writes the body of the email and attaches the excel file create previously .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename tmpxlsx temp;
ods excel file=tmpxlsx options(sheet_name="Female");

proc print data=sashelp.class;
  where sex = "F";
run;

ods excel options(sheet_name="Male");

proc print data=sashelp.class;
  where sex = "M";
run;

ods excel close;

filename outbox email

  to='abc@def.com'

  from='abc@def.com'
  attach=(
    "%sysfunc(pathname(tmpxlsx))"
    name="someName"
    ct='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
    ext="xlsx"
  ) 

  subject='Sample First Program'
;

DATA _null_;
  file outbox;
  PUT 'Please find attached the report';
  PUT ' ';
  PUT 'Thankyou';
RUN;

filename tmpxlsx clear;
filename outbox clear;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2016 10:24:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Receiving-2-separate-emails-when-trying-to-put-email-body-in/m-p/286807#M16450</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2016-07-25T10:24:54Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving 2 separate emails when trying to put email body in excel sheet generated using ODS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Receiving-2-separate-emails-when-trying-to-put-email-body-in/m-p/286817#M16452</link>
      <description>&lt;P&gt;seems its easier in 9.4 however i am still on&amp;nbsp;9.3 only &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I got the following error when trying to run the code :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: Unable to load module 'SpreadsheetML' from template store!&lt;BR /&gt;ERROR: No body file. EXCEL output will not be created.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2016 11:04:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Receiving-2-separate-emails-when-trying-to-put-email-body-in/m-p/286817#M16452</guid>
      <dc:creator>PreenaKaur</dc:creator>
      <dc:date>2016-07-25T11:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving 2 separate emails when trying to put email body in excel sheet generated using ODS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Receiving-2-separate-emails-when-trying-to-put-email-body-in/m-p/286819#M16453</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The use this code sample, change excel to use tagsets.excelxp also changed the extension to XML.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename tmpxlsx temp;
ods tagsets.excelxp file=tmpxlsx options(sheet_name="Female");

proc print data=sashelp.class;
  where sex = "F";
run;

ods tagsets.excelxp options(sheet_name="Male");

proc print data=sashelp.class;
  where sex = "M";
run;

ods tagsets.excelxp close;

filename outbox email

  to='abc@def.com'

  from='abc@def.com'
  attach=(
    "%sysfunc(pathname(tmpxlsx))"
    name="someName"
    ct='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
    ext="xml"
  ) 

  subject='Sample First Program'
;

DATA _null_;
  file outbox;
  PUT 'Please find attached the report';
  PUT ' ';
  PUT 'Thankyou';
RUN;

filename tmpxlsx clear;
filename outbox clear;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2016 11:23:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Receiving-2-separate-emails-when-trying-to-put-email-body-in/m-p/286819#M16453</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2016-07-25T11:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving 2 separate emails when trying to put email body in excel sheet generated using ODS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Receiving-2-separate-emails-when-trying-to-put-email-body-in/m-p/287112#M16462</link>
      <description>&lt;P&gt;Thanks a lot Bruno !&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Its working for me now ,hope this will work when running from DI (as a batch run) as well ! (I am checking for this)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2016 07:22:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Receiving-2-separate-emails-when-trying-to-put-email-body-in/m-p/287112#M16462</guid>
      <dc:creator>PreenaKaur</dc:creator>
      <dc:date>2016-07-26T07:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving 2 separate emails when trying to put email body in excel sheet generated using ODS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Receiving-2-separate-emails-when-trying-to-put-email-body-in/m-p/290084#M16592</link>
      <description>&lt;P&gt;Hi Bruno,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This program works very smoothly from enterprise guide however when I schedule this (in overnight batch run) I am not getting any email . I think its related to some of my access but i am not sure which access it is? (&lt;SPAN&gt;DR_GSD_USER_BATCH referes to batch name&lt;/SPAN&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: Insufficient authorization to access /opt/sas/env5/lev1/config/sascompute/Lev1/SASApp/DR_GSD_USER_BATCH.lst.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any ideas please?&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;</description>
      <pubDate>Mon, 08 Aug 2016 05:01:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Receiving-2-separate-emails-when-trying-to-put-email-body-in/m-p/290084#M16592</guid>
      <dc:creator>PreenaKaur</dc:creator>
      <dc:date>2016-08-08T05:01:56Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving 2 separate emails when trying to put email body in excel sheet generated using ODS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Receiving-2-separate-emails-when-trying-to-put-email-body-in/m-p/290381#M16599</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the name of the file implies, that you where using a relative file name and the the user does not have the right to write to the full path.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need a filename where you can always write, I suggest to use the follwoing approach:&lt;/P&gt;
&lt;P&gt;write the the file to the location, where the WORK library is pointing too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code below shows a way to do this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let tempFile = %sysfunc(pathname(work))/sample.lst;

%put NOTE: &amp;amp;=tempFile;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
      <pubDate>Tue, 09 Aug 2016 06:46:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Receiving-2-separate-emails-when-trying-to-put-email-body-in/m-p/290381#M16599</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2016-08-09T06:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving 2 separate emails when trying to put email body in excel sheet generated using ODS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Receiving-2-separate-emails-when-trying-to-put-email-body-in/m-p/290873#M16605</link>
      <description>&lt;P&gt;Hi Bruno,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did the changes and now not getting previous error message but still there is no email and no error message in the log.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My code was as follows:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;filename tmpxlsx temp;&lt;BR /&gt;%let tmpxlsx = %sysfunc(pathname(work))/sample.lst;&lt;BR /&gt;%put NOTE: &amp;amp;=tmpxlsx;&lt;/P&gt;
&lt;P&gt;ods tagsets.excelxp file=tmpxlsx options(sheet_name="Female");&lt;BR /&gt;proc print data=sashelp.class;&lt;BR /&gt; where sex = "F";&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;ods tagsets.excelxp options(sheet_name="Male");&lt;BR /&gt;proc print data=sashelp.class;&lt;BR /&gt; where sex = "M";&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;ods tagsets.excelxp close;&lt;/P&gt;
&lt;P&gt;filename outbox email&lt;BR /&gt; to='abc@abc.com'&lt;BR /&gt; from='def@def.com'&lt;BR /&gt; attach=(&lt;BR /&gt; "%sysfunc(pathname(tmpxlsx))" &lt;BR /&gt; ct='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'&lt;BR /&gt; ext="xls"&lt;BR /&gt; )&lt;/P&gt;
&lt;P&gt;subject='Sample Third Program'&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;DATA _null_;&lt;BR /&gt; file outbox;&lt;BR /&gt; PUT 'Please find attached the report';&lt;BR /&gt; PUT ' ';&lt;BR /&gt; PUT 'Thankyou';&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;filename tmpxlsx clear;&lt;BR /&gt;filename outbox clear;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;seems file is created but not in work library:&lt;/P&gt;
&lt;P&gt;MPRINT(READSAS): filename outbox email to='abc@abc.com' from='def@def.com' attach=( &lt;BR /&gt;"/sasworka/env5/lev1/SAS_work038300001E1E_mg5g02n01a/#LN00026" &lt;BR /&gt;ct='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ext="xls" ) subject='Sample Third Program' ;&lt;BR /&gt;MPRINT(READSAS): DATA _null_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Apologies If I am doing something wrong, I am fairly new to SAS!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Aug 2016 05:30:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Receiving-2-separate-emails-when-trying-to-put-email-body-in/m-p/290873#M16605</guid>
      <dc:creator>PreenaKaur</dc:creator>
      <dc:date>2016-08-11T05:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: Receiving 2 separate emails when trying to put email body in excel sheet generated using ODS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Receiving-2-separate-emails-when-trying-to-put-email-body-in/m-p/291276#M16612</link>
      <description>&lt;P&gt;I assume that for batch the ODS LISTING destination is open.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So as the first line in your code, add the following:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ODS _ALL_ CLOSE;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This will close any open destinations, and only the ones you have in your code are used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2016 14:37:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Receiving-2-separate-emails-when-trying-to-put-email-body-in/m-p/291276#M16612</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2016-08-12T14:37:25Z</dc:date>
    </item>
  </channel>
</rss>

