<?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: Exporting Excel file from SAS with individual sheet per dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/363024#M85846</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nice one thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Although when I run your code below...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get the following error when trying to download the file = 'Unable to open the external viewer. There is no application associated with the '.sge' file type.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 31 May 2017 11:10:56 GMT</pubDate>
    <dc:creator>CamRutherford</dc:creator>
    <dc:date>2017-05-31T11:10:56Z</dc:date>
    <item>
      <title>Exporting Excel file from SAS with individual sheet per dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/362971#M85811</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the below code whereby I can export multiple datasets as individual attachments in an email. However, I want to export one excel document with each dataset on a seperate sheet. Any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%let user = tul0crf;
%let dataset=CLUB_MEMBERS;
%let dataset1=/user/&amp;amp;user/CLUB_MEMBERS.txt;
%let dataseta=CLUB_TRANSACTIONS;
%let dataset2=/user/&amp;amp;user/CLUB_TRANSACTIONS.txt;
Data &amp;amp;dataset;
set CLUB_MEMBERS;
run;
proc export data=&amp;amp;dataset
   outfile="&amp;amp;dataset1"
   dbms=tab
   replace; 
   run;
Data &amp;amp;dataseta;
set CLUB_TRANSACTIONS;
run;
proc export data=&amp;amp;dataseta
   outfile="&amp;amp;dataset2"
   dbms=tab
   replace; 
   run;

***update email recipients here***;
filename mymail email 
   To=("cameron@gmail.com" )
   subject="SAS CLUBS REPORT EXPORT"
   attach=("&amp;amp;dataset1" "&amp;amp;dataset2");

data _null_;
   file mymail;
   put 'Hi there,';
   put "Please see the attached files";
   put"Thanks,";
   put"CWR automated message";
 run; 


&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Cam&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 09:18:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/362971#M85811</guid>
      <dc:creator>CamRutherford</dc:creator>
      <dc:date>2017-05-31T09:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting Excel file from SAS with individual sheet per dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/362975#M85813</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/116539"&gt;@CamRutherford&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Which approach to take depends on your version of SAS.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/kb/51/580.html" target="_blank"&gt;http://support.sas.com/kb/51/580.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code creating the Excel Workbook could be as simple as:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let myexcel=c:\temp\myexcel.xlsx;

/* delete excel from previous runs */
x "del /q ""&amp;amp;myexcel""";

/* write SAS tables to Excel tabs */
libname myxlsx xlsx "&amp;amp;myexcel";
proc  datasets lib=myxlsx nolist nowarn;
  copy 
    in=sashelp
    out=myxlsx;
  select 
    class airline;
  run;
quit;
libname myxlsx clear;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 May 2017 09:40:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/362975#M85813</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-05-31T09:40:45Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting Excel file from SAS with individual sheet per dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/362977#M85814</link>
      <description>&lt;P&gt;What SAS version are you using, and what type of file is acceptable? &amp;nbsp;The reason I ask is that there are several methods to get data out to Excel, then proc export as you have, tagsets.excelxp, libname excel - this for instance is 9.4 only. &amp;nbsp;Let me give a quick example of each - I assume in all that all datasets are in lib TEMP:&lt;/P&gt;
&lt;P&gt;Proc export:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set sashelp.vtable (where=(libname="TEMP"));
  if _n_=1 then call execute('proc export datafile="abc.xls" replace; sheet="'||strip(memname)||'||'"; run;');
  else call execute('proc export datafiles="abc.xls" replace; sheet="'||strip(memname)||'"; run;');
run;&lt;/PRE&gt;
&lt;P&gt;Tagsets.excelxp:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set sashelp.vtable (where=(libname="TEMP")) end=last;&lt;BR /&gt;  if _n_=1 then call execute('ods tagsets.excelxp file="abc.xml";');&lt;BR /&gt;  call execute('ods tagsets.excelxp options(sheet_name="'||strip(memname)||'");&lt;BR /&gt;                proc report data=temp.'||strip(memname)||' nowd; columns _all_; run;');&lt;BR /&gt;  if last then call execute('ods tagsets.excelxp close;');&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;Libname in 9.4:&lt;/P&gt;
&lt;PRE&gt;libname temp excel "abc.xlsx";

proc datasets library=temp;
  copy out=temp;
run;

libname temp clear;&lt;/PRE&gt;
&lt;P&gt;So as you can see, libname is easiest, tagsets create xml output which can be read by Excel, but allow a lot of formatting and such like, and proc export is the most basic. &amp;nbsp;If you have 94 prob best to use libname.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 09:35:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/362977#M85814</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-05-31T09:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting Excel file from SAS with individual sheet per dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/362987#M85820</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have now got this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATA PRDSALE;
     SET SASHELP.PRDSALE;
     DIFFERENCE = ACTUAL-PREDICT;
  RUN;
PROC SORT DATA=PRDSALE; 
BY COUNTRY REGION DIVISION YEAR; 
RUN; 
QUIT;
ods listing close;
ods tagsets.excelxp file='test.xml' style=statistical
options(auto_subtotals='yes' 
default_column_width='7, 10, 10, 7, 7'
frozen_rowheaders='yes' 
sheet_interval='none' 
sheet_name='Canada'
autofilter='all' 
autofilter_table='2');

  proc print data=prdsale noobs label split='*';
     where country eq 'CANADA' and year eq 1993;
     id country region division;
     var prodtype product quarter month year;
     sum predict / style={tagattr='format:Currency'};
     sum actual / style={tagattr='format:Currency'};
     sum difference / style={tagattr='format:Currency formula:RC[-1]-RC[-2]'};
     label prodtype = 'Product*Type'
           predict  = 'Predicted*Sales'
           actual   = 'Actual*Sales';
  run; quit;
ods tagsets.excelxp options(sheet_interval='none' sheet_name='Germany');
  proc print data=prdsale noobs label split='*';
     where country eq 'GERMANY' and year eq 1993;
     id country region division;
     var prodtype product quarter month year;
     sum predict / style={tagattr='format:Currency'};
     sum actual / style={tagattr='format:Currency'};
     sum difference / style={tagattr='format:Currency formula:RC[-1]-RC[-2]'};
     label prodtype = 'Product*Type'
           predict  = 'Predicted*Sales'
           actual   = 'Actual*Sales';
  run; quit;
  ods tagsets.excelxp close;
  ods listing;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However I want to be able to send the excel file as an email using the below...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;***update email recipients here***;
filename mymail email 
   To=("cameron@gmail.com" )
   subject="SAS CLUBS REPORT EXPORT"
   attach=("&amp;amp;dataset1" "&amp;amp;dataset2");

data _null_;
   file mymail;
   put 'Hi there,';
   put "Please see the attached files";
   put"Thanks,";
   put"CWR automated message";
 run; &lt;/PRE&gt;</description>
      <pubDate>Wed, 31 May 2017 10:03:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/362987#M85820</guid>
      <dc:creator>CamRutherford</dc:creator>
      <dc:date>2017-05-31T10:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting Excel file from SAS with individual sheet per dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/362988#M85821</link>
      <description>&lt;P&gt;Well, you don't need two proc reports, you can do:&lt;/P&gt;
&lt;PRE&gt;ods tagsets.excelxp file=... options(sheet_interval="bygroup");

proc report data=...;
  by country;
  where year=1993;
...
run;

ods tagsets.excelxp close;&lt;/PRE&gt;
&lt;P&gt;So use the by group processing within one proc report.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for your question on how to attach, I am not sure what you ask, can you not just attach the created file:&lt;/P&gt;
&lt;PRE&gt;   attach=("&amp;lt;path&amp;gt;\test.xml");&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 10:11:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/362988#M85821</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-05-31T10:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting Excel file from SAS with individual sheet per dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/362994#M85825</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks both!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I now have one final problem...when I get the email with the attachment it says the file is corrupt - how can I fix this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATA PRDSALE;
     SET SASHELP.PRDSALE;
     DIFFERENCE = ACTUAL-PREDICT;
  RUN;
PROC SORT DATA=PRDSALE; 
BY COUNTRY REGION DIVISION YEAR; 
RUN; 
QUIT;

ods tagsets.excelxp file='test.xls' options(sheet_interval="bygroup");

proc report data=PRDSALE;
  by country;
  where year=1993;
run;
ods tagsets.excelxp close;
                                        
FILENAME SEND EMAIL                                                                              
     TO      =  'cameron@test.com'                                  
     SUBJECT =  'MULTI-SHEET'                             
	attach=("test.xls");                       
     ;                                                              
  DATA _NULL_;                                                      
     FILE SEND ;                                                    
     PUT 'PLEASE RECEIVE THE ATTACHED. -- REGARDS,';                
RUN ;          &lt;/PRE&gt;</description>
      <pubDate>Wed, 31 May 2017 10:20:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/362994#M85825</guid>
      <dc:creator>CamRutherford</dc:creator>
      <dc:date>2017-05-31T10:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting Excel file from SAS with individual sheet per dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/362995#M85826</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/116539"&gt;@CamRutherford&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Hmmm.... First thing I'd do is to open the file from the disk location where you've created it. Is Excel also telling you that this file is corrupt.&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 10:22:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/362995#M85826</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-05-31T10:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting Excel file from SAS with individual sheet per dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/362998#M85827</link>
      <description>&lt;P&gt;When I open the file it says: 'The file you are trying to open, 'tmpE3AF.tmp.xls', is in a different format than specified by the file extension. Verify thatthe file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I open it and it's fine, but when I send by an email it doesn't like it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 10:27:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/362998#M85827</guid>
      <dc:creator>CamRutherford</dc:creator>
      <dc:date>2017-05-31T10:27:45Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting Excel file from SAS with individual sheet per dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/362999#M85828</link>
      <description>&lt;P&gt;Yes, its likely because you have called the file XLS - which is old Office binary file type, but your actually creating XML output. &amp;nbsp;You should really call the file:&lt;/P&gt;
&lt;P&gt;test.xml&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you can if need be call it test.xlsx (however you will still get messages from Excel).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It basically telling you the file format is not as expected.&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 10:28:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/362999#M85828</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-05-31T10:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting Excel file from SAS with individual sheet per dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/363000#M85829</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/116539"&gt;@CamRutherford&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Call your file in your code test.xls&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;x&lt;/FONT&gt;&amp;nbsp;and try again.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW: If you're using a current SAS version then use ODS EXCEL. That's the preferred ods destination for interfacing with Excel.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/odsug/69832/HTML/default/viewer.htm#p09n5pw9ol0897n1qe04zeur27rv.htm&amp;nbsp;" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/odsug/69832/HTML/default/viewer.htm#p09n5pw9ol0897n1qe04zeur27rv.htm&amp;nbsp;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 10:35:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/363000#M85829</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-05-31T10:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting Excel file from SAS with individual sheet per dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/363001#M85830</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried xlsx and it says its corrupted still.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 10:32:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/363001#M85830</guid>
      <dc:creator>CamRutherford</dc:creator>
      <dc:date>2017-05-31T10:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting Excel file from SAS with individual sheet per dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/363004#M85831</link>
      <description>&lt;P&gt;What SAS version are you using? Try&amp;nbsp;&lt;SPAN&gt;ODS EXCEL if possible.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 10:36:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/363004#M85831</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-05-31T10:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting Excel file from SAS with individual sheet per dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/363005#M85832</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I amend to use ODS Excel?&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 10:37:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/363005#M85832</guid>
      <dc:creator>CamRutherford</dc:creator>
      <dc:date>2017-05-31T10:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting Excel file from SAS with individual sheet per dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/363006#M85833</link>
      <description>&lt;P&gt;Can you show me the equivalent of what I have as ODS excel please?&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 10:38:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/363006#M85833</guid>
      <dc:creator>CamRutherford</dc:creator>
      <dc:date>2017-05-31T10:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting Excel file from SAS with individual sheet per dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/363007#M85834</link>
      <description>&lt;P&gt;SAS Version&amp;nbsp;6.1 M1HF7 (6.100.0.4234) (64-bit)&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 10:39:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/363007#M85834</guid>
      <dc:creator>CamRutherford</dc:creator>
      <dc:date>2017-05-31T10:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting Excel file from SAS with individual sheet per dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/363010#M85836</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/116539"&gt;@CamRutherford&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;ODS EXCEL - &amp;nbsp;give me a sec&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS version 6.1?!? That must be the EG client version and not the version of the SAS server.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please run the following&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc setinit;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And then post what you find in the log under:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Current version:&amp;nbsp;&amp;lt;and here the version&amp;gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 10:43:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/363010#M85836</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-05-31T10:43:28Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting Excel file from SAS with individual sheet per dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/363015#M85838</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes its Enterprise Guide.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't have anything that says 'current version'&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 10:53:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/363015#M85838</guid>
      <dc:creator>CamRutherford</dc:creator>
      <dc:date>2017-05-31T10:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting Excel file from SAS with individual sheet per dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/363017#M85839</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/116539"&gt;@CamRutherford&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;For ODS EXCEL basically the same code than what you've posted (see below). This will only work with a current version of SAS.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA PRDSALE;
     SET SASHELP.PRDSALE;
     DIFFERENCE = ACTUAL-PREDICT;
  RUN;
PROC SORT DATA=PRDSALE; 
BY COUNTRY REGION DIVISION YEAR; 
RUN; 
QUIT;

ods excel file='c:\temp\test.xlsx' options(sheet_interval="bygroup");

proc report data=PRDSALE;
  by country;
  where year=1993;
run;
ods excel close;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I could replicate the issue you've raised with ODS TAGSET.EXCELXP. Things work for me without issues when using ODS EXCEL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 11:02:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/363017#M85839</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-05-31T11:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting Excel file from SAS with individual sheet per dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/363019#M85841</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/116539"&gt;@CamRutherford&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;You need to run the following code out of EG in a program window.&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; setinit&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then check the log. That will give you the version of SAS on the server where your SAS code executes.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS EG is only the client. What SAS syntax will work depends on the version of your SAS server which executes the code and not on the version of the client.&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 10:58:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/363019#M85841</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-05-31T10:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting Excel file from SAS with individual sheet per dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/363020#M85842</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't understand how I can run the below code and then able to download the excel file and view perctly fine but then when sending the email it doesn't like the file I have and tells me it's corrupt in all different file extensions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATA PRDSALE;
     SET SASHELP.PRDSALE;
     DIFFERENCE = ACTUAL-PREDICT;
  RUN;
PROC SORT DATA=PRDSALE; 
BY COUNTRY REGION DIVISION YEAR; 
RUN; 
QUIT;

ods tagsets.excelxp file='test.xml' options(sheet_interval="bygroup");

proc report data=PRDSALE;
  by country;
  where year=1993;
run;
ods tagsets.excelxp close;
    
 
FILENAME SEND EMAIL                                                                              
     TO      =  'cameron.rutherford@rci.com'                                  
     SUBJECT =  'MULTI-SHEET'                             
	attach=("test.xml");                       
     ;                                                              
  DATA _NULL_;                                                      
     FILE SEND ;                                                    
     PUT 'PLEASE RECEIVE THE ATTACHED. -- REGARDS,';                
RUN ;          


&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've just ran ...&lt;/P&gt;&lt;LI-CODE lang="sas"&gt;&amp;lt;span class="token procnames"&amp;gt;proc&amp;lt;/span&amp;gt; setinit&amp;lt;span class="token punctuation"&amp;gt;;&amp;lt;/span&amp;gt;&amp;lt;span class="token procnames"&amp;gt;run&amp;lt;/span&amp;gt;&amp;lt;span class="token punctuation"&amp;gt;;&amp;lt;/span&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;and I get this...&lt;/P&gt;&lt;PRE&gt;proc setinit;run;

NOTE: PROCEDURE SETINIT used (Total process time):
      real time           0.00 seconds
      user cpu time       0.00 seconds
      system cpu time     0.00 seconds
      memory              339.65k
      OS Memory           35992.00k
      Timestamp           05/31/2017 07:00:05 AM
      Step Count                        83  Switch Count  18
      Page Faults                       0
      Page Reclaims                     62
      Page Swaps                        0
      Voluntary Context Switches        35
      Involuntary Context Switches      9
      Block Input Operations            544
      Block Output Operations           0
      
Original site validation data
Site name:    'SITE XXXXX'.
Site number:  XXXXX.
Expiration:   29JUN2017.
Grace Period:  45 days (ending 13AUG2017).
Warning Period: 45 days (ending 27SEP2017).
System birthday:   26JUL2016.
Operating System:   LIN X64 .&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 11:04:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-Excel-file-from-SAS-with-individual-sheet-per-dataset/m-p/363020#M85842</guid>
      <dc:creator>CamRutherford</dc:creator>
      <dc:date>2017-05-31T11:04:06Z</dc:date>
    </item>
  </channel>
</rss>

