The SAS Output Delivery System and reporting techniques

Identifying when the spanning page triggers when using 'PAGE' option of define statement

Reply
Occasional Contributor
Posts: 5

Identifying when the spanning page triggers when using 'PAGE' option of define statement

Hi everyone,

I have been trying to accomplish the following for a long time but lack an understanding of how Proc Report works 'behind the scenes':

When Proc report has to output a lot of columns so that they span over multiple pages, I add the PAGE option to the Define statement to indicate what columns I want to move over to another page. Now in my page title I have 'Page 1 of 1' and this gets repeated for all spanning pages, but what I want is to display '(Continued) Page 1 of 1' on the spanned pages.

I have tried to identify when this PAGE option triggers in a compute before _PAGE_ block so that I can modify the value displayed, but with no success. Anyone know how I need to approach this?

Thanks you!

Tiaan

SAS Super FREQ
Posts: 8,720

Re: Identifying when the spanning page triggers when using 'PAGE' option of define statement

Hi:

  You do not indicate what your destination of interest is. Page numbering will only work with RTF and PDF destinations, not HTML. You also do not indicate HOW you are setting the Page title page 1 of 1 -- in a SAS TITLE statement? In a COMPUTE BEFORE block? Your only opportunity to change the SAS TITLE statement is between procedure calls. A "continued" string can be made to appear automatically if you use TAGSETS.RTF destination, but you did not indicate whether you might be using that destination or not.

  Generally, for the most help with questions, it is useful to see your code and have a sample of your data. Or, if you cannot post your data, then use one of the SASHELP datasets to replicate your issue. However, it is also useful to check for Tech Support notes which might be relevant to your usage question:

37576 - PAGE option on DEFINE statement in PROC REPORT is ignored when routing to ODS

  Also, for information about how PROC REPORT processes behind the scenes, there is a whole documentation topic on the subject that is quite good. Base SAS(R) 9.3 Procedures Guide, Second Edition (How Proc Report Builds a Report)

  Note that (when you read the documentation) options which were originally designed for the LISTING destination or OUTPUT window do not typically work with other ODS destination (such as FLOW, HEADLINE, HEADSKIP, PAGE, DOL, DUL, OL, UL, SPACING, etc)

cynthia

Occasional Contributor
Posts: 5

Re: Identifying when the spanning page triggers when using 'PAGE' option of define statement

Hi Cynthia,

Thank you for your help and advice, I will try and elaborate on what I am doing. I am currently using the ODS rtf destination and I generate all my titles and footnotes in compute before/after _page_ blocks. I have attached sample output (page 1 only) and the related SAS code is shown at the end of this message.

I have not yet looked into the TAGSETS.RTF destination as most of our code is inherited from previous SAS versions. Is it possible to place this 'continued' string generated by TAGSETS.RTF anywhere you want?

Tech support note 37576 does not influence my current code as I simply subset my data into proc report one page at a time (the PAGE option still 'works' in that it places the correct columns on the next spanned page).

The following SAS code generates the attached output and It is the 'pagetext' variable in the compute before block that I would like to change when page 1 goes over to the next page.

ODS RTF FILE = "&docpath." BODYTITLE STYLE =styles.t%UPCASE(&dtims.) HEADERY=1 FOOTERY=1 DEVICE=sasemf;

ODS proclabel = "&dtit.";

ODS escapechar='^';

ODS RESULTS OFF;

PROC REPORT DATA = reportds NOWINDOWS MISSING SPACING=1 SPLIT="~" HEADLINE out=tempreport

            STYLE(REPORT) = [BACKGROUND=WHITE FRAME=VOID JUST=L RULES=none PROTECTSPECIALCHARS=off]

            STYLE(HEADER) = [BACKGROUND=WHITE JUST=C PROTECTSPECIALCHARS=off]

            STYLE(COLUMN) = [BACKGROUND=WHITE JUST=C PROTECTSPECIALCHARS=off]

            CONTENTS = ''

            ;

  COLUMN pagetext pagetext2 foottext _pb_page var_01

  ("xxxxxxxxx^R/RTF'\brdrb\brdrth\brdrw10\brsp1'" var_02 var_03)

  blksep

  ("yyyyyyyyy^R/RTF'\brdrb\brdrth\brdrw10\brsp1'" var_04 var_05)

  ("aaaaaaaaa^R/RTF'\brdrb\brdrth\brdrw10\brsp1'" var_02=v2 var_03=v3)

  blksep

  ("bbbbbbbbb^R/RTF'\brdrb\brdrth\brdrw10\brsp1'" var_04=v4 var_05=v5)

  ;

  DEFINE pagetext   / NOPRINT;

  DEFINE pagetext2  / NOPRINT;

  DEFINE foottext   / NOPRINT;

  DEFINE _pb_page   / ORDER=INTERNAL ORDER NOPRINT;

  DEFINE var_01     / WIDTH = 10 STYLE(COLUMN)=[CELLWIDTH=&maxlen1. % ASIS=yes JUST=c] STYLE(HEADER)=[JUST=c ASIS=yes BORDERBOTTOMCOLOR=black BORDERBOTTOMWIDTH=1] "var_01" ORDER=INTERNAL ORDER ID;

  DEFINE var_02     / WIDTH = 10 STYLE(COLUMN)=[CELLWIDTH=&maxlen2. % ASIS=yes JUST=c] STYLE(HEADER)=[JUST=c ASIS=yes BORDERBOTTOMCOLOR=black BORDERBOTTOMWIDTH=1] "var_02" ;

  DEFINE var_03     / WIDTH = 10 STYLE(COLUMN)=[CELLWIDTH=&maxlen3. % ASIS=yes JUST=c] STYLE(HEADER)=[JUST=c ASIS=yes BORDERBOTTOMCOLOR=black BORDERBOTTOMWIDTH=1] "var_03" ;

  DEFINE var_04     / WIDTH = 10 STYLE(COLUMN)=[CELLWIDTH=&maxlen4. % ASIS=yes JUST=c] STYLE(HEADER)=[JUST=c ASIS=yes BORDERBOTTOMCOLOR=black BORDERBOTTOMWIDTH=1] "var_04" ;

  DEFINE var_05     / WIDTH = 10 STYLE(COLUMN)=[CELLWIDTH=&maxlen5. % ASIS=yes JUST=c] STYLE(HEADER)=[JUST=c ASIS=yes BORDERBOTTOMCOLOR=black BORDERBOTTOMWIDTH=1] "var_05" ;

  DEFINE v2         / WIDTH = 10 STYLE(COLUMN)=[CELLWIDTH=&maxlen2. % ASIS=yes JUST=c] STYLE(HEADER)=[JUST=c ASIS=yes BORDERBOTTOMCOLOR=black BORDERBOTTOMWIDTH=1] "var_02 alias" PAGE;

  DEFINE v3         / WIDTH = 10 STYLE(COLUMN)=[CELLWIDTH=&maxlen3. % ASIS=yes JUST=c] STYLE(HEADER)=[JUST=c ASIS=yes BORDERBOTTOMCOLOR=black BORDERBOTTOMWIDTH=1] "var_03 alias" ;

  DEFINE v4         / WIDTH = 10 STYLE(COLUMN)=[CELLWIDTH=&maxlen4. % ASIS=yes JUST=c] STYLE(HEADER)=[JUST=c ASIS=yes BORDERBOTTOMCOLOR=black BORDERBOTTOMWIDTH=1] "var_04 alias" ;

  DEFINE v5         / WIDTH = 10 STYLE(COLUMN)=[CELLWIDTH=&maxlen5. % ASIS=yes JUST=c] STYLE(HEADER)=[JUST=c ASIS=yes BORDERBOTTOMCOLOR=black BORDERBOTTOMWIDTH=1] "var_05 alias" ;

  DEFINE blksep     / WIDTH = 10 STYLE(COLUMN)=[CELLWIDTH=&blksep.  % ASIS=yes JUST=c] STYLE(HEADER)=[JUST=c ASIS=yes BORDERBOTTOMCOLOR=black BORDERBOTTOMWIDTH=1] " " ;

                        

  BREAK AFTER _pb_page / PAGE;

  COMPUTE BEFORE _PAGE_;

    LINE "^S={JUST=l}xxxxx left aligned xxxxx" @&_extratit1len. pagetext $144.;

    LINE "^S={JUST=l}xxxx left aligned2xxxx" @&_dprotlen. pagetext2 $144.;

    LINE "^S={FONT_SIZE=&fontsize2.pt}&bjoin.^R/RTF'\pvmrg\posyt\brdrb\brdrth\brdrw25\brsp1' ^S={FONT_SIZE=&fontsize.pt}";

    LINE "Long title text string";

  ENDCOMP;

  COMPUTE AFTER _page_ ;

    LINE "^S={JUST=l FONT_SIZE=&fontsize.pt}Footnote1";

    LINE "Footnote2";

    LINE "Footnote3";

    LINE "^S={FONT_SIZE=&fontsize2.pt}&sym_space.^R/RTF'\pvmrg\posyb\brdrt\brdrth\brdrw25\brsp1\line' ^S={FONT_SIZE=&fontsize.pt}" foottext $144.;

  ENDCOMP;

RUN;

ODS RTF CLOSE;

Thank you!

Tiaan

SAS Super FREQ
Posts: 8,720

Re: Identifying when the spanning page triggers when using 'PAGE' option of define statement

Hi:

I would recommend that you work with Tech Support. Someone will have to actually look at your data or test data that replicates the issue. They will need to see how you create the pagetext and pagetext2 variables and what their values are as the calculated page changes and the values of all your macro variables in order to try to understand what's happening. I note that you are using @ pointer control in your LINE statement -- in my experience, this works better with LISTING than with any other destination. I also note that you are using options like WIDTH, HEADLINE, HEADSKIP, SPACING, etc, which will also be ignored by a non-LISTING destination like RTF. I do not see the use of the PAGE option on the DEFINE statement, but I do see the use of the PAGE option on the BREAK statement, so that explains why the subject line of your original post was confusing and why I referenced the irrelevant note.

  It was my understanding that TAGSETS.RTF was created to allow for the vertical measurement of pages in your SAS output, so that the page break that SAS inserted into the RTF file would be used by Word. The technique that you show (making your own page break variable) was the type of technique used before TAGSETS.RTF (or measured RTF) was introduced. The TAGSETS.RTF destination has several features that make it seem more compatible with what you want to do:

1) automatically inserts a continued line by default by a table breaks across pages

2) puts a title and footnote in the appropriate places, using the SAS TITLE and FOOTNOTE statements (instead of a COMPUTE block) and the TITLE and FOOTNOTES are not placed in the header of the document when Word opens the file

  I think that investigating TAGSETS.RTF would be worth your effort, as it might simplify your code.

cynthia

Ask a Question
Discussion stats
  • 3 replies
  • 336 views
  • 3 likes
  • 2 in conversation