BookmarkSubscribeRSS Feed
pmane
Fluorite | Level 6

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

4 REPLIES 4
Cynthia_sas
Diamond | Level 26

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

pmane
Fluorite | Level 6

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

Cynthia_sas
Diamond | Level 26


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

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1602 views
  • 0 likes
  • 2 in conversation