<?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 can I tell what page of an RTF output I'm on using proc report? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-tell-what-page-of-an-RTF-output-I-m-on-using-proc/m-p/939107#M368788</link>
    <description>&lt;P&gt;Thanks for the quick reply! I've always known in the back of my mind something like this was an option, I've been trying to find a way to have proc report compute the variable automatically if at all possible though. I'm trying to do this for a few different reports that have different sizes of header and footer so the number of rows per page may not always be the same. Also, page_count is just for demonstration, it would not be displayed on the final table.&lt;/P&gt;</description>
    <pubDate>Tue, 13 Aug 2024 18:25:29 GMT</pubDate>
    <dc:creator>elderneff</dc:creator>
    <dc:date>2024-08-13T18:25:29Z</dc:date>
    <item>
      <title>How can I tell what page of an RTF output I'm on using proc report?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-tell-what-page-of-an-RTF-output-I-m-on-using-proc/m-p/939097#M368786</link>
      <description>&lt;P&gt;Hi, long time viewer and first time poster!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm making an RTF output using proc report and I want to define a column that increments with each new page of the RTF. I'm trying to use the _PAGE_ target in a compute statement to try to recognize when the RTF starts a new page but it seems to have a different definition of "page" than I do. I've read documentation, Googled, and even asked ChatGPT - does anyone here have any insight?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code I'm running:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data example;
    do group = 1 to 3;
        do i = 1 to 20;
            var1 = group;
            var2 = i;
            output;
        end;
    end;
run;

ODS LISTING CLOSE;
ODS RTF FILE = "newpage.rtf";

PROC REPORT DATA = example; 
    COLUMN var1 var2 PAGE_COUNT;
    DEFINE var1 / DISPLAY;
    DEFINE var2 / DISPLAY;
    DEFINE PAGE_COUNT / COMPUTED;

    COMPUTE PAGE_COUNT;
        PAGE_COUNT = 1;
    endcomp;
    COMPUTE AFTER _PAGE_;
        PAGE_COUNT + 1;
        LINE 'This should be at the end of every page';
    endcomp;
RUN;

ODS RTF CLOSE;
ODS LISTING;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the (undesirable) RTF output it gives:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-08-13 113157.png" style="width: 901px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/99215iB93798DDD3001D35/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-08-13 113157.png" alt="Screenshot 2024-08-13 113157.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I'm hoping I can end up with:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-08-13 113336.png" style="width: 906px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/99216iA777541D18E8C9D9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-08-13 113336.png" alt="Screenshot 2024-08-13 113336.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks, Jacob&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 17:35:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-tell-what-page-of-an-RTF-output-I-m-on-using-proc/m-p/939097#M368786</guid>
      <dc:creator>elderneff</dc:creator>
      <dc:date>2024-08-13T17:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: How can I tell what page of an RTF output I'm on using proc report?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-tell-what-page-of-an-RTF-output-I-m-on-using-proc/m-p/939103#M368787</link>
      <description>&lt;P&gt;I would suggest that one solution would be to add a variable to your data to control appearance unless this "report" is going to frequently change fonts, cell border padding and such that change "page" size.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And do you actually want the "page_count" to appear in the body or was that just for demonstration?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe something like this?&lt;/P&gt;
&lt;PRE&gt;data example;
    do group = 1 to 3;
        do i = 1 to 20;
            counter=sum(counter,1);
            page_num=int(counter/25);
            var1 = group;
            var2 = i;
            output;
        end;
    end;
run;

ODS RTF FILE = "x:\newpage.rtf";

PROC REPORT DATA = example; 
    COLUMN page_num var1 var2 ;
    define page_num /noprint order ;
    DEFINE var1 / DISPLAY;
    DEFINE var2 / DISPLAY;
    break after page_num/page;
    COMPUTE AFTER page_num;
        LINE 'This should be at the end of every page';
    endcomp;
RUN;

ODS RTF CLOSE;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Aug 2024 18:18:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-tell-what-page-of-an-RTF-output-I-m-on-using-proc/m-p/939103#M368787</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-08-13T18:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: How can I tell what page of an RTF output I'm on using proc report?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-tell-what-page-of-an-RTF-output-I-m-on-using-proc/m-p/939107#M368788</link>
      <description>&lt;P&gt;Thanks for the quick reply! I've always known in the back of my mind something like this was an option, I've been trying to find a way to have proc report compute the variable automatically if at all possible though. I'm trying to do this for a few different reports that have different sizes of header and footer so the number of rows per page may not always be the same. Also, page_count is just for demonstration, it would not be displayed on the final table.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 18:25:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-tell-what-page-of-an-RTF-output-I-m-on-using-proc/m-p/939107#M368788</guid>
      <dc:creator>elderneff</dc:creator>
      <dc:date>2024-08-13T18:25:29Z</dc:date>
    </item>
    <item>
      <title>Re: How can I tell what page of an RTF output I'm on using proc report?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-tell-what-page-of-an-RTF-output-I-m-on-using-proc/m-p/939116#M368790</link>
      <description>&lt;P&gt;Not for RTF.&amp;nbsp; RTF is like HTML in that sense.&amp;nbsp; What "page" something appears on is depended on the tool used to render the text of the RTF file.&amp;nbsp; Choose a different printer (or page size) and where the page breaks appear will change.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want fixed pages make a PDF file.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 19:10:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-tell-what-page-of-an-RTF-output-I-m-on-using-proc/m-p/939116#M368790</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-08-13T19:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: How can I tell what page of an RTF output I'm on using proc report?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-tell-what-page-of-an-RTF-output-I-m-on-using-proc/m-p/939136#M368794</link>
      <description>&lt;P&gt;Ah okay, that's what I feared. Thank you for the confirmation though Tom, I really appreciate it! Sounds like the previous response is the best workaround then since I'm limited to RTFs. Thanks again, Jacob&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 20:28:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-tell-what-page-of-an-RTF-output-I-m-on-using-proc/m-p/939136#M368794</guid>
      <dc:creator>elderneff</dc:creator>
      <dc:date>2024-08-13T20:28:18Z</dc:date>
    </item>
  </channel>
</rss>

