<?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 generate multiple excel workbooks with ODS procedure in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-multiple-excel-workbooks-with-ODS-procedure/m-p/297773#M16846</link>
    <description>&lt;P&gt;In your first ODS statement, do not set a sheet name, instead set &lt;FONT face="courier new,courier"&gt;sheet_interval='none'&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;Then, in your %do loop, use an additional &lt;FONT face="courier new,courier"&gt;ods tagsets.excelxp options()&lt;/FONT&gt; to set the sheet_name for each dataset.&lt;/P&gt;</description>
    <pubDate>Mon, 12 Sep 2016 14:59:17 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2016-09-12T14:59:17Z</dc:date>
    <item>
      <title>How to generate multiple excel workbooks with ODS procedure</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-multiple-excel-workbooks-with-ODS-procedure/m-p/297770#M16845</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am&amp;nbsp;very new to SAS and I am stuck at trying to&amp;nbsp;write a code (within a macro) which generates a seperate excel workbook for each outputed SAS dataset. I have managed to write a code which puts all of the datasets into a single workbook (in different tabs), but as outputs might get quite large the single workbook will become too heavy to work with. Here is the code that I have:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ODS TAGSETS.EXCELXP FILE=&amp;amp;PATH STYLE=STATISTICAL
OPTIONS(FROZEN_ROWHEADERS='YES' SHEET_NAME="SEL"
             AUTOFILTER='ALL');

%DO K=1 %TO &amp;amp;NUM;

PROC PRINT DATA= SEL&amp;amp;K;
RUN;

%END;

ODS TAGSETS.EXCELXP CLOSE;	&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The &amp;amp;NUM variable represents the final line of my conditions file (I have a conditions table with 1-30 rows e.g. it might have 10, 15, 5 rows etc.) so the&amp;nbsp;code at the moment is telling SAS to create as many tabs in the excel workbook according to the number of rows in my conditions table. The above code is part of a bigger Macro.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code&amp;nbsp;that I have in order&amp;nbsp;to generate the NUM variable:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA _NULL_;
SET _CH1 END=EOF;
IF EOF THEN CALL SYMPUTX('NUM',_N_);
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The version of SAS that I am using is: SAS Enterprise Guide 7.1 (64-bit).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help on how to put each dataset in a seperate workbook instead of into a single workbook, so that i end up with 1 to&amp;nbsp;n different workbooks will be much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Todor&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2016 14:45:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-multiple-excel-workbooks-with-ODS-procedure/m-p/297770#M16845</guid>
      <dc:creator>Todor</dc:creator>
      <dc:date>2016-09-12T14:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate multiple excel workbooks with ODS procedure</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-multiple-excel-workbooks-with-ODS-procedure/m-p/297773#M16846</link>
      <description>&lt;P&gt;In your first ODS statement, do not set a sheet name, instead set &lt;FONT face="courier new,courier"&gt;sheet_interval='none'&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;Then, in your %do loop, use an additional &lt;FONT face="courier new,courier"&gt;ods tagsets.excelxp options()&lt;/FONT&gt; to set the sheet_name for each dataset.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2016 14:59:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-multiple-excel-workbooks-with-ODS-procedure/m-p/297773#M16846</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-09-12T14:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate multiple excel workbooks with ODS procedure</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-multiple-excel-workbooks-with-ODS-procedure/m-p/297779#M16848</link>
      <description>&lt;P&gt;Hi Kurt,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Many thanks for your response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code at the moment looks like that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ODS TAGSETS.EXCELXP FILE=&amp;amp;PATH STYLE=STATISTICAL
OPTIONS(FROZEN_ROWHEADERS='YES' SHEET_INTERVAL='NONE'
             AUTOFILTER='ALL');

%DO K=1 %TO &amp;amp;NUM;

PROC PRINT DATA= SEL&amp;amp;K;RUN;
%END;

ODS TAGSETS.EXCELXP CLOSE;	&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I didn't put another ODS statment in the loop as it is not important the name of the sheet as there will be only one single sheet per workbook.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when I run the code I get everything in the same workbook, in a single worksheet, each simulation below the other.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think this is due to the path variable which at the moment is set as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;CODE class=" language-sas"&gt;path='****\Results\MULTITABLE1.XLS');&lt;/CODE&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Hence, it is putting everything in the same workbook. Do you know how this can be fixed?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Thank you very much in advance,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Best wishes,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Todor&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2016 15:18:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-multiple-excel-workbooks-with-ODS-procedure/m-p/297779#M16848</guid>
      <dc:creator>Todor</dc:creator>
      <dc:date>2016-09-12T15:18:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate multiple excel workbooks with ODS procedure</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-multiple-excel-workbooks-with-ODS-procedure/m-p/297791#M16849</link>
      <description>&lt;P&gt;Each ODS TAGSETS.EXCELXP statement with the FILE= option creates a new workbook. Move both ODS TAGSETS.EXCELXP statements inside the macro loop&amp;nbsp;and&amp;nbsp;specify a different file name for each&amp;nbsp;iteration of the loop.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2016 16:38:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-multiple-excel-workbooks-with-ODS-procedure/m-p/297791#M16849</guid>
      <dc:creator>Tim_SAS</dc:creator>
      <dc:date>2016-09-12T16:38:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate multiple excel workbooks with ODS procedure</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-multiple-excel-workbooks-with-ODS-procedure/m-p/297794#M16850</link>
      <description>&lt;P&gt;Hi Tim,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for the suggestion. I am not very clear on how I can specify a different file name for each iteration of the loop. Some example code would be of great help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2016 16:48:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-multiple-excel-workbooks-with-ODS-procedure/m-p/297794#M16850</guid>
      <dc:creator>Todor</dc:creator>
      <dc:date>2016-09-12T16:48:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate multiple excel workbooks with ODS procedure</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-multiple-excel-workbooks-with-ODS-procedure/m-p/297919#M16856</link>
      <description>&lt;P&gt;Remove the single quotes and the .xls extension from the declaration of the macro variable path.&lt;/P&gt;
&lt;P&gt;Then move the ODS statements inside the %do loop, and do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods tagsets excelxp file="&amp;amp;path&amp;amp;i..xls" .........;&lt;BR /&gt;/* output generating code */&lt;BR /&gt;ods tagsets.excelxp close;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Sep 2016 06:11:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-multiple-excel-workbooks-with-ODS-procedure/m-p/297919#M16856</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-09-13T06:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate multiple excel workbooks with ODS procedure</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-multiple-excel-workbooks-with-ODS-procedure/m-p/297936#M16857</link>
      <description>&lt;P&gt;Many thanks Kurt.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code is doing what I want it to now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best wishes&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2016 07:42:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-multiple-excel-workbooks-with-ODS-procedure/m-p/297936#M16857</guid>
      <dc:creator>Todor</dc:creator>
      <dc:date>2016-09-13T07:42:50Z</dc:date>
    </item>
  </channel>
</rss>

