BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,
We are generating reports through proc report in SAS EG and we have a requirement in which we want column headers not to be repeated in all the pages.It should only be displayed on the first page.We dont want to use line statements since the output file is pdf.
So can you give me a solution.
4 REPLIES 4
Cynthia_sas
Diamond | Level 26
Hi:
Once you start PROC REPORT so it produces headers on page 1, it will produce headers on all subsequent pages. However, PROC REPORT does have the NOHEADER option. I'd consider trying something like this:
1) figure out how many observations will print on the first page, with the headers and then:
[pre]
ods pdf file='xxx.pdf';

proc report data=lib.file(obs=37) nowd;
run;

proc report data=lib.file(firstobs=38) nowd noheader;
run;
ods pdf close;
[/pre]

This will display up to and including obs 37 on the first PDF page and then the rest of the obs will display starting on the second page with the noheader option. This approach will work better with a detail report than with a summary report.

But, assuming you do have a detail report, this also gives you a chance to change titles between page 1 and the rest of the pages. Of course, depending on your font size, you may get more or less than 37 obs on the first page, so you'd have to adjust your code accordingly.

cynthia
deleted_user
Not applicable
Hi Cynthia,
Thanks a lot for your solution.
It works but the problem is that we have some detail list reports in which we have all character cols which has lot of description so we are not sure how many obs will fit in one page.
So we are having problem in these kind of report.
So pls if you have any other solution let me know.
prholland
Fluorite | Level 6
Sunil,

Why not run the whole report with NOHEADER, then add a single LINE statement containing the headers you require in an RBREAK BEFORE section?

..........Phil
deleted_user
Not applicable
Back in the days before Proc Report, this would have been a data step writing information with explicit PUT statements. The Option LinesLeft on the File statement would allow me to name a variable which would keep count of the number of lines remaining on a page.

My step would have named blocks of code so I could conditionally call up a footer, a header, a data first line section, or a data follow line section depending on my position on the page. I remember a little patience was needed to test my conditional statements, and often it would be the third or fourth attempt when I would find the right numbers to get the layout correct.

Kind regards

David

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 1494 views
  • 0 likes
  • 3 in conversation