Help using Base SAS procedures

PROC REPORT no repeated headers

Posts: 63

PROC REPORT no repeated headers


I am struggling with PROC REPORT a lot. Firstly I would need to somehow "compress" the output since my report is in RTF landscape, and the headers of the report columns might be quite long and steal most of the space available on the page. The problem is that if the header takes a lot of room then only 1-3 observation rows will fit into the landscape page, and every time a page changes the header is replicated by default in PROC REPORT. This leads to an "infinite loop" where there will be thousands of pages all containing only few observations and all other area is filled with the headers. So what I would want is that there would be only one header per PROC REPORT print, so that the table would continue to the next page without the header replication.


I attached an example of my PROC REPORT code.

It might be that my SAS knowledge is too limited or this problem is not doable with SAS but I hope someone could help me out.

There could be an optional way to reduce the header size with font size (but this method is really limited since the text becomes unreadable very soon). Other way would be that if I could somehow control the total width of the main across variable (in sample code var5) and let the second across variable (sample code var6) vary in length freely "under" the first across variable. This however does not work with outputwidth command and I have to fix both across variable widths as a constant. My report is dynamic and constant column widths are "stupid" for my use (in my opinion this is one of the biggest issues with SAS, compared to competitive alternatives, that you can't explicitly tell PROC REPORT to have total maximum width for the table and under that constraint it can automatically decide the proper widths for the columns, PLEASE CORRECT ME IF I AM WRONG).

Super User
Super User
Posts: 9,599

Re: PROC REPORT no repeated headers

Well.  Firstly I would say that is a bad idea.  It make reviewing the table very difficult as you constantly need to scroll up to see what each column is.  My recommendation is to shrink the headers to a reasonable length, they are after all descriptives and need to be verbose.  So instead of:

This column header was created on 12jun2014 using data derived from version 1 of the data and is the component.



With a footnote to explain it.  There are numerous techniques for this and different approaches.

If you really need to do it, and are prepared for the backlash from the reviewer then:

- Create a row in your dataset with the labels

- Proc report the data, and set the labels to missing

I wouldn't recommend it though.

Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation