<?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: Excel export to multiple sheets not working with filerefs in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Excel-export-to-multiple-sheets-not-working-with-filerefs/m-p/767072#M243135</link>
    <description>&lt;P&gt;Works fine for me on Windows SAS version 9.4 (TS1M5)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path=%sysfunc(pathname(work));
%let fname=&amp;amp;path/test_file.xlsx;

filename xlsx "&amp;amp;fname";
proc export dbms=xlsx data=sashelp.class outfile=xlsx replace ;
  sheet="sheet1";
run;

proc export dbms=xlsx data=sashelp.class outfile=xlsx replace ;
  sheet="sheet2";
run;

libname check xlsx "&amp;amp;fname";
proc copy inlib=check outlib=work;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log&lt;/P&gt;
&lt;PRE&gt;13    %let path=%sysfunc(pathname(work));
14    %let fname=&amp;amp;path/test_file.xlsx;
15
16    filename xlsx "&amp;amp;fname";
17    proc export dbms=xlsx data=sashelp.class outfile=xlsx replace ;
18      sheet="sheet1";
19    run;

NOTE: The export data set has 19 observations and 5 variables.
NOTE: "XLSX" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
      real time           0.02 seconds
      cpu time            0.03 seconds


20
21    proc export dbms=xlsx data=sashelp.class outfile=xlsx replace ;
22      sheet="sheet2";
23    run;

NOTE: The export data set has 19 observations and 5 variables.
NOTE: "XLSX" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
      real time           0.03 seconds
      cpu time            0.01 seconds


24
25    libname check xlsx "&amp;amp;fname";
NOTE: Libref CHECK was successfully assigned as follows:
      Engine:        XLSX
      Physical Name: C:...\test_file.xlsx
26    proc copy inlib=check outlib=work;
27    run;

NOTE: Copying CHECK.SHEET1 to WORK.SHEET1 (memtype=DATA).
NOTE: BUFSIZE is not cloned when copying across different engines. System Option for BUFSIZE was used.
NOTE: The import data set has 19 observations and 5 variables.
NOTE: There were 19 observations read from the data set CHECK.SHEET1.
NOTE: The data set WORK.SHEET1 has 19 observations and 5 variables.
NOTE: Copying CHECK.SHEET2 to WORK.SHEET2 (memtype=DATA).
NOTE: BUFSIZE is not cloned when copying across different engines. System Option for BUFSIZE was used.
NOTE: The import data set has 19 observations and 5 variables.
NOTE: There were 19 observations read from the data set CHECK.SHEET2.
NOTE: The data set WORK.SHEET2 has 19 observations and 5 variables.
NOTE: PROCEDURE COPY used (Total process time):
      real time           0.02 seconds
      cpu time            0.03 seconds


&lt;/PRE&gt;</description>
    <pubDate>Fri, 10 Sep 2021 16:34:38 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-09-10T16:34:38Z</dc:date>
    <item>
      <title>Excel export to multiple sheets not working with filerefs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-export-to-multiple-sheets-not-working-with-filerefs/m-p/767060#M243130</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;can anyone please explain to me why this code works fine, and I get an Excel workbook with four sheets:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc export dbms=xlsx outfile="S:\Employee\XXXXXXX\LTC_43_turnout.xlsx" data=prov_sum replace;
	sheet="by Province";
run;

proc export dbms=xlsx outfile="S:\Employee\XXXXXXX\LTC_43_turnout.xlsx" data=fed_sum(where=(site_typ_id=18)) replace;
	sheet="by FED - LTC";
run;

proc export dbms=xlsx outfile="S:\Employee\XXXXXXX\LTC_43_turnout.xlsx" data=fed_sum(where=(site_typ_id=15)) replace;
	sheet="by FED - Seniors' Home";
run;

proc export dbms=xlsx outfile="S:\Employee\XXXXXXX\LTC_43_turnout.xlsx" data=fed_sum(where=(site_typ_id=9)) replace;
	sheet="by FED - Hospital";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While the exact same code, only using a file reference instead of a hardcoded filename, produces a workbook with the last sheet only?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename outF "S:\Employee\XXXXXXX\LTC_43_turnout.xlsx";

proc export dbms=xlsx outfile=outF data=prov_sum replace;
	sheet="by Province";
run;

proc export dbms=xlsx outfile=outF data=fed_sum(where=(site_typ_id=18)) replace;
	sheet="by FED - LTC";
run;

proc export dbms=xlsx outfile=outF data=fed_sum(where=(site_typ_id=15)) replace;
	sheet="by FED - Seniors' Home";
run;

proc export dbms=xlsx outfile=outF data=fed_sum(where=(site_typ_id=9)) replace;
	sheet="by FED - Hospital";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is there a magic, secret part of the SAS documentation I might have overlooked? My SAS version is 9.4M7&lt;/P&gt;</description>
      <pubDate>Fri, 10 Sep 2021 15:52:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-export-to-multiple-sheets-not-working-with-filerefs/m-p/767060#M243130</guid>
      <dc:creator>gabonzo</dc:creator>
      <dc:date>2021-09-10T15:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: Excel export to multiple sheets not working with filerefs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-export-to-multiple-sheets-not-working-with-filerefs/m-p/767072#M243135</link>
      <description>&lt;P&gt;Works fine for me on Windows SAS version 9.4 (TS1M5)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path=%sysfunc(pathname(work));
%let fname=&amp;amp;path/test_file.xlsx;

filename xlsx "&amp;amp;fname";
proc export dbms=xlsx data=sashelp.class outfile=xlsx replace ;
  sheet="sheet1";
run;

proc export dbms=xlsx data=sashelp.class outfile=xlsx replace ;
  sheet="sheet2";
run;

libname check xlsx "&amp;amp;fname";
proc copy inlib=check outlib=work;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log&lt;/P&gt;
&lt;PRE&gt;13    %let path=%sysfunc(pathname(work));
14    %let fname=&amp;amp;path/test_file.xlsx;
15
16    filename xlsx "&amp;amp;fname";
17    proc export dbms=xlsx data=sashelp.class outfile=xlsx replace ;
18      sheet="sheet1";
19    run;

NOTE: The export data set has 19 observations and 5 variables.
NOTE: "XLSX" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
      real time           0.02 seconds
      cpu time            0.03 seconds


20
21    proc export dbms=xlsx data=sashelp.class outfile=xlsx replace ;
22      sheet="sheet2";
23    run;

NOTE: The export data set has 19 observations and 5 variables.
NOTE: "XLSX" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
      real time           0.03 seconds
      cpu time            0.01 seconds


24
25    libname check xlsx "&amp;amp;fname";
NOTE: Libref CHECK was successfully assigned as follows:
      Engine:        XLSX
      Physical Name: C:...\test_file.xlsx
26    proc copy inlib=check outlib=work;
27    run;

NOTE: Copying CHECK.SHEET1 to WORK.SHEET1 (memtype=DATA).
NOTE: BUFSIZE is not cloned when copying across different engines. System Option for BUFSIZE was used.
NOTE: The import data set has 19 observations and 5 variables.
NOTE: There were 19 observations read from the data set CHECK.SHEET1.
NOTE: The data set WORK.SHEET1 has 19 observations and 5 variables.
NOTE: Copying CHECK.SHEET2 to WORK.SHEET2 (memtype=DATA).
NOTE: BUFSIZE is not cloned when copying across different engines. System Option for BUFSIZE was used.
NOTE: The import data set has 19 observations and 5 variables.
NOTE: There were 19 observations read from the data set CHECK.SHEET2.
NOTE: The data set WORK.SHEET2 has 19 observations and 5 variables.
NOTE: PROCEDURE COPY used (Total process time):
      real time           0.02 seconds
      cpu time            0.03 seconds


&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Sep 2021 16:34:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-export-to-multiple-sheets-not-working-with-filerefs/m-p/767072#M243135</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-09-10T16:34:38Z</dc:date>
    </item>
    <item>
      <title>Re: Excel export to multiple sheets not working with filerefs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-export-to-multiple-sheets-not-working-with-filerefs/m-p/767078#M243138</link>
      <description>It works for me on my other PC, which has 9.4 M4 if I am not wrong. Perhaps it's a bug introduced in the newest release?</description>
      <pubDate>Fri, 10 Sep 2021 17:16:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-export-to-multiple-sheets-not-working-with-filerefs/m-p/767078#M243138</guid>
      <dc:creator>gabonzo</dc:creator>
      <dc:date>2021-09-10T17:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: Excel export to multiple sheets not working with filerefs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-export-to-multiple-sheets-not-working-with-filerefs/m-p/796571#M255631</link>
      <description>&lt;P&gt;It's a known bug: &lt;A href="https://support.sas.com/kb/68/654.html" target="_blank"&gt;https://support.sas.com/kb/68/654.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 15:04:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-export-to-multiple-sheets-not-working-with-filerefs/m-p/796571#M255631</guid>
      <dc:creator>gabonzo</dc:creator>
      <dc:date>2022-02-16T15:04:46Z</dc:date>
    </item>
  </channel>
</rss>

