The SAS Output Delivery System and reporting techniques

Custom Page Break - on either change of a group value or max records reached on a page

Reply
New Contributor
Posts: 3

Custom Page Break - on either change of a group value or max records reached on a page

Hi,

I was hoping sas community will pitch in to help me solve this problem.

Aim: 1. insert a page break on reaching the max records allowed on 1 page

         2. insert a page break on change of group number i.e every new group data appears on new page

sample data:

_N_     GroupNo     PageNo(expectedResult)

1               1                    1

2               1                    1

3               1                    1

4               1                    1

--------------------------------------------------------(this line is NOT the part of data)

5               1                    2

6               1                    2

-------------------------------------------------------(this line is NOT the part of data)

7               2                    3

8               2                    3

9               2                    3

10             2                    3

-----------------------------------------------------(this line is NOT the part of data)

11             2                    4

12             2                    4

13             2                    4

In the above example:

max records on 1 page = 4

Currently, this is the code I have written (that does not work as I want it to)

data paging;

     retain recbrk_ 1;

     retain maxRecords 4;

     if(mod(_N_,maxRecords) eq 1 or first.groupno) then recbrk_ = recbrk_ + 1;

run;

proc report....

     ...

          break after recbrk_/ page;

     ....

run;

output i get :

_N_     GroupNo     recbrk_

1               1                    1

2               1                    1

3               1                    1

4               1                    1

--------------------------------------------------------(this line is NOT the part of data)

5               1                    2

6               1                    2

-------------------------------------------------------(this line is NOT the part of data)

7               2                    3

-------------------------------------------------------(this line is NOT the part of data)

8               2                    4

9               2                    4

10             2                    4

11             2                    4

-----------------------------------------------------(this line is NOT the part of data)

12             2                    5

13             2                    5

Any suggestions / comments will be helpful.Thank you  in advance !

Poonam

SAS Super FREQ
Posts: 8,645

Re: Custom Page Break - on either change of a group value or max records reached on a page

Hi:

Have you searched support.sas.com? There is an example of using a calculated variable to generate your own page breaking variable. I believe that it was written expressly for showing how to control page breaking in ODS RTF. You did not show your destination of interest, but even if it is not ODS RTF, the program that they used to illustrate the technique is something you could use as a model.

cynthia

New Contributor
Posts: 3

Re: Custom Page Break - on either change of a group value or max records reached on a page

Thank you Cynthia for your reply.

Yes my query is for ODS RTF. I have tried to search support.sas.com as you have mentioned, but unsuccessfully. It would be great if you could please point me to the example you are referring, that i can use as a model ?


-Poonam

SAS Super FREQ
Posts: 8,645

Re: Custom Page Break - on either change of a group value or max records reached on a page


Hi:

I was thinking of this note: http://support.sas.com/kb/7/887.html The full code tab shows how to create a page breaking variable and then using it.

cynthia

New Contributor
Posts: 3

Re: Custom Page Break - on either change of a group value or max records reached on a page

thank you Cynthia !

Post a Question
Discussion Stats
  • 4 replies
  • 497 views
  • 0 likes
  • 2 in conversation