BookmarkSubscribeRSS Feed
Calcite | Level 5

I have a report with 21 columns so the ID option is imperative in the 3rd Display statement. Therefore, the columns 1-3 are shown on every page. There are many records in the dataset and I'm using SAS v9.4.


It turns out that columns 1-9 appear on the first page that shows the first 35 records. Page 2 shows columns 1-9 for records 36-70; page 3 shows columns 1-9 for records 71-105, etcetera until all records have been displayed. Then, after columns 1-9 have been displayed for all records, the next page shows columns 1-3 and 10-15 for the first 35 records, followed by columns 1-3 and 10-15 for the next 35 records, etcetera.


What I really want is for page 1 to show columns 1-9 for the first 35 records, then page 2 should show columns 1-3 and 10-15 for these same records, then page 3 shows columns 1-3 and 16-21 for the same 35 records. After ALL columns for the first 35 records are displayed, then I want the next 35 records to be shown on consecutive pages until the columns have been exhausted (that is, columns 1-9 on a page; columns 1-3 with 10-15 on the next page; and columns 1-3 with 16-21 on the next page).


I guess another way of saying this is I want Proc Report to keep observations together across consecutive pages.


I searched the internet and discussion boards without luck. Any ideas?

Jade | Level 19

Sorry, can't help to solve the issue. But i am curious: what is the purpose of a report that i have to print and arrange the sheets on my desk to read it?

Diamond | Level 26 RW9
Diamond | Level 26

Nope, there is no magic do my report button, you have to design it.  Me, if I need a complicated report output I manipulate the data beforehand.  This is one place where splitting the data out does make sense, split it out so you get the data you want to see on each page, assign sort order variables so that you can group/order properly (using order=data), plus you can control line splitting/page splitting easier.  

Super User

Summarize the data, sort in the desired order and use multiple proc print statements with the VAR statement changing.


Or possibly Proc tabulate with multiple tables statements with the first 3 row variables the same and an ods destination setting to start each table on a new page.


Or send output to something in landscape orientation with largish paper and a style that uses a small font. 21 columns sounds quite doable, depending on the column widths, to fit on legal paper in landscape orientation.


It might help to show your proc report code to get better results.





You have 35 observations per page.  So consider something like


data need;

  set have;




Can you then run your proc report with a BY PAGNUM statement?   If the BY-line can't be eliminated, I guess you might have to go with 34 or 33 obs per pagnum.

The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

Calcite | Level 5

I wish there was a SAS option to do this, but this answer is brilliant!

Thank you.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 5 replies
  • 1 like
  • 5 in conversation