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
SAS Super FREQ

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
SAS Super FREQ


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

sas-innovate-2024.png

Today is the last day to save with the early bird rate! Register today for just $695 - $100 off the standard rate.

 

Plus, pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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