<?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: Proc Report in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/re-Proc-Report/m-p/353489#M18442</link>
    <description>&lt;P&gt;Hi.....I have 5 datasets and I am trying to create a excel file with multiple worksheets and each worksheet represents a&amp;nbsp;separate client. Each client worksheet should contain 5 stacked tables ( Table 1 from dataset1, Table 2 from dataset2,...., Table 5 from dataset5). If there were 10 unique clients in the datasets, then I would expect to have 10 worksheets and on each worksheet should be 5 tables. I am using ods excelXP. Any suggestions on the best way to create this excel file. Thanks.&lt;/P&gt;</description>
    <pubDate>Tue, 25 Apr 2017 22:46:27 GMT</pubDate>
    <dc:creator>twildone</dc:creator>
    <dc:date>2017-04-25T22:46:27Z</dc:date>
    <item>
      <title>re: Proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/re-Proc-Report/m-p/353489#M18442</link>
      <description>&lt;P&gt;Hi.....I have 5 datasets and I am trying to create a excel file with multiple worksheets and each worksheet represents a&amp;nbsp;separate client. Each client worksheet should contain 5 stacked tables ( Table 1 from dataset1, Table 2 from dataset2,...., Table 5 from dataset5). If there were 10 unique clients in the datasets, then I would expect to have 10 worksheets and on each worksheet should be 5 tables. I am using ods excelXP. Any suggestions on the best way to create this excel file. Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 22:46:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/re-Proc-Report/m-p/353489#M18442</guid>
      <dc:creator>twildone</dc:creator>
      <dc:date>2017-04-25T22:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: re: Proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/re-Proc-Report/m-p/353501#M18443</link>
      <description>&lt;P&gt;I would go with ods tagsets.excelXP and then take advantage of the "sheet_name" and "sheet_interval" options.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Set the sheet_interval to "none" at the start of each client and the&amp;nbsp;sheet_name to "Client #1". The five tables will then go on that one tab. Then for the next client, when you change the sheet_name to "client #2" at the start of the next client, your next set of five tables will go on that tab.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But that's just what I'd do.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 23:20:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/re-Proc-Report/m-p/353501#M18443</guid>
      <dc:creator>collinelliot</dc:creator>
      <dc:date>2017-04-25T23:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: re: Proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/re-Proc-Report/m-p/353503#M18444</link>
      <description>&lt;P&gt;Do you have something similar this that creates the individual tables?&lt;/P&gt;
&lt;PRE&gt;proc report data=data1;
where somevariable='Client1';
&amp;lt;report body&amp;gt;;
run;

proc report data=data2;
where somevariable='Client1';
&amp;lt;report body&amp;gt;;
run;

proc report data=data3;
where somevariable='Client1';
&amp;lt;report body&amp;gt;;
run;

proc report data=data4;
where somevariable='Client1';
&amp;lt;report body&amp;gt;;
run;

proc report data=data5;
where somevariable='Client1';
&amp;lt;report body&amp;gt;;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Apr 2017 23:28:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/re-Proc-Report/m-p/353503#M18444</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-04-25T23:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: re: Proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/re-Proc-Report/m-p/353513#M18445</link>
      <description>&lt;P&gt;This is a demo version of what I explained awkwardly. You can adapt it to work with a macro, but this gives you the basic idea of generating multiple sets of output per tab.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;yourPath\DemoOutput.xml"
    options(sheet_name = 'Client 1' sheet_interval = 'none');

    proc print data = sashelp.class;
    run;

    proc print data = sashelp.class;
    run;


ods tagsets.excelxp options(sheet_name = 'Client 2' sheet_interval = 'none');


    proc print data = sashelp.class;
    run;

    proc print data = sashelp.class;
    run;

ods tagsets.excelxp close;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Apr 2017 23:50:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/re-Proc-Report/m-p/353513#M18445</guid>
      <dc:creator>collinelliot</dc:creator>
      <dc:date>2017-04-25T23:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: re: Proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/re-Proc-Report/m-p/353517#M18446</link>
      <description>&lt;P&gt;Here is an example you may be able to follow:&lt;/P&gt;
&lt;PRE&gt;data names;
   input name $;
datalines;
Alfred
Carol
Judy
;
run;

data _null_;
   set names end=lastname;
   if _n_=1 then 
   call execute('ods tagsets.excelxp file="D:\data\sheettest.xml" ;');
   call execute('ods tagsets.excelxp options(sheet_interval="table");');
   call execute('ods tagsets.excelxp options(sheet_interval="none");');
   call execute('ods tagsets.excelxp options (sheet_name="'||name||'" sheet_label=" ");');
   call execute('Proc print data=sashelp.class (obs=1) noobs; where name="'||name||'";run;');
   call execute('Proc print data=sashelp.class (obs=1) noobs; where name="'||name||'";run;');
   if lastname then 
   call execute('ods tagsets.excelxp close;');
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Key parts: the _n_ = 1 is so that the ods tagsets.excelxp is created only once.&lt;/P&gt;
&lt;P&gt;The two sheet inteval calls are from trial and error that seem to force the tagset to creat a new sheet each time the 'none' gets hit.&lt;/P&gt;
&lt;P&gt;The where= clauses use values from&amp;nbsp;the control data set created above.&lt;/P&gt;
&lt;P&gt;The data set option end creates a variable, lastname, that is true when the last record in the names data set is processed. So that puts the ODS close statement.&lt;/P&gt;
&lt;P&gt;I demonstrate with two calls to proc print to show that the output goes to the same page in the work sheet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if you have macros or macro variables involved&amp;nbsp;then stop and don't even try this until you show us the code using them. Macro's behave differently than you may expect with call execute.&lt;/P&gt;
&lt;P&gt;Note that the Call execute can have lots of lines of code if the body of the report procedures is the same for each repor you can place it&lt;/P&gt;
&lt;P&gt;all in one call execute statement.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 23:53:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/re-Proc-Report/m-p/353517#M18446</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-04-25T23:53:51Z</dc:date>
    </item>
  </channel>
</rss>

