<?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 Does the page() method work inside of a table when you're using RWI? in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Does-the-page-method-work-inside-of-a-table-when-you-re-using/m-p/808624#M25723</link>
    <description>&lt;P&gt;A quick question: is there a way to force a page break in the middle of a table when using RWI? Sample code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;ods _all_ close;
ods pdf file="&amp;amp;outpath/rwitest.pdf";
options nodate nonumber;

title;
footnote;

proc sort data=sashelp.baseball out=baseball;
by team name;
run;

data _null_;
length dataval $ 200;
set baseball end=last;
by team;
if _n_ eq 1 then do;
   declare odsout o();
   o.table_start();
   o.body_start();
end;

if first.team and _n_ ne 1 then
   o.page();
 
dataval = catx(' - ',team,name);
o.row_start();
o.format_cell(data: dataval);
o.row_end();

if last then do;
   o.body_end();
   o.table_end();
   o.delete();
end;
run;

ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This has to run inside SAS Studio.&lt;/P&gt;</description>
    <pubDate>Tue, 19 Apr 2022 17:09:29 GMT</pubDate>
    <dc:creator>derekmor54</dc:creator>
    <dc:date>2022-04-19T17:09:29Z</dc:date>
    <item>
      <title>Does the page() method work inside of a table when you're using RWI?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Does-the-page-method-work-inside-of-a-table-when-you-re-using/m-p/808624#M25723</link>
      <description>&lt;P&gt;A quick question: is there a way to force a page break in the middle of a table when using RWI? Sample code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;ods _all_ close;
ods pdf file="&amp;amp;outpath/rwitest.pdf";
options nodate nonumber;

title;
footnote;

proc sort data=sashelp.baseball out=baseball;
by team name;
run;

data _null_;
length dataval $ 200;
set baseball end=last;
by team;
if _n_ eq 1 then do;
   declare odsout o();
   o.table_start();
   o.body_start();
end;

if first.team and _n_ ne 1 then
   o.page();
 
dataval = catx(' - ',team,name);
o.row_start();
o.format_cell(data: dataval);
o.row_end();

if last then do;
   o.body_end();
   o.table_end();
   o.delete();
end;
run;

ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This has to run inside SAS Studio.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 17:09:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Does-the-page-method-work-inside-of-a-table-when-you-re-using/m-p/808624#M25723</guid>
      <dc:creator>derekmor54</dc:creator>
      <dc:date>2022-04-19T17:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: Does the page() method work inside of a table when you're using RWI?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Does-the-page-method-work-inside-of-a-table-when-you-re-using/m-p/808817#M25724</link>
      <description>&lt;P&gt;Hi:&lt;BR /&gt;My understanding is that you may not be able to force a page break with RWI under some conditions such as with ODS LAYOUT. However, unless your desired output is more complex, you could use PROC REPORT or a SAS Macro program to handle the page breaking, as an alternative. &lt;BR /&gt;&lt;BR /&gt;But it looks like you want to end the table for each BY group, so I think you need to use your o.page() on the FIRST.TEAM and LAST.TEAM conditions. Here's what I was able to produce with this approach (using only 2 teams):&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1650462328055.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/70640i6DD54B46CD51B7A2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1650462328055.png" alt="Cynthia_sas_0-1650462328055.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Although I think for a simple report such as you show, my tendency would be to use PROC REPORT. But I suspect your real report must be more complex.&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 13:46:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Does-the-page-method-work-inside-of-a-table-when-you-re-using/m-p/808817#M25724</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2022-04-20T13:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: Does the page() method work inside of a table when you're using RWI?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Does-the-page-method-work-inside-of-a-table-when-you-re-using/m-p/808869#M25725</link>
      <description>&lt;P&gt;Yes, my situation is more complicated; it's more akin to:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data _null_;
length dataval $ 200;
set baseball end=last;
by team position;
retain page 1;
if _n_ eq 1 then
   declare odsout o();

if first.team then
   o.table_start();

dataval = catx(' - ',position,team,name);
o.row_start();
o.format_cell(data: dataval);
o.row_end();

if last.position then do;
   o.row_start();
   o.format_cell(data:page,overrides:'just=r');
   o.row_end();
   o.page();
   page + 1;
end;
   
if last.team then 
   o.table_end();
   
if last then 
   o.delete();
run;

ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Suppressing the PDF bookmark that gets generated at the table_start() method is the issue. Fortunately, a PROC REPORT soluition already exists, but this was for an independent validation that explicitly did not use PROC REPORT. However, from a little further testing and your code, it looks like the PAGE() method doesn't work without closing the table.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 16:34:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Does-the-page-method-work-inside-of-a-table-when-you-re-using/m-p/808869#M25725</guid>
      <dc:creator>derekmor54</dc:creator>
      <dc:date>2022-04-20T16:34:40Z</dc:date>
    </item>
  </channel>
</rss>

