BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
SuryaKiran
Meteorite | Level 14

Hello Community,

 

Trying to find a way to suppress headers if the data flows to multiple pages in the same PROC REPORT.

 

data class;
set sashelp.class sashelp.class sashelp.class;
run;

ods pdf file="/user/Test_for_Header.pdf" ;
proc report data=class;
run;
ods pdf close;

I don't want the header on page 2. 

 

image.png

Thanks,
Suryakiran
1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

Change all the numeric variable into character.

 

data class;
length name sex _age _weight _height $ 40;
if _n_=1 then do;
name='name';sex='sex';_age='age';_weight='weight';_height='height';
output;
end;
set sashelp.class sashelp.class sashelp.class;
_age=put(age,best8. -l);
_weight=put(weight,best8. -l);
_height=put(height,best8. -l);
output;
drop age weight height;
run;

ods pdf file='c:\temp\x.pdf';
proc report data=class noheader;
compute name;
 n+1;
 if n=1 then call define(_row_,'style','style=header{fontsize=4 fontweight=blod}');
endcomp;
run;
ods pdf close;

View solution in original post

6 REPLIES 6
Cynthia_sas
SAS Super FREQ

Hi, you would need to run 2 REPORT steps.
1) page 1 uses regular column headers
2) page 2 and all subsequent pages use NOHEADER option on the PROC REPORT statement. Here's what it looks like:

Cynthia_sas_0-1611873913240.png

Cynthia

SuryaKiran
Meteorite | Level 14

Thanks for your reply @Cynthia_sas. Unfortunately I can't run two proc report, because I have another proc report before that might have varying rows. Rows count can't be pre-defined. 

Thanks,
Suryakiran
Ksharp
Super User

Change all the numeric variable into character.

 

data class;
length name sex _age _weight _height $ 40;
if _n_=1 then do;
name='name';sex='sex';_age='age';_weight='weight';_height='height';
output;
end;
set sashelp.class sashelp.class sashelp.class;
_age=put(age,best8. -l);
_weight=put(weight,best8. -l);
_height=put(height,best8. -l);
output;
drop age weight height;
run;

ods pdf file='c:\temp\x.pdf';
proc report data=class noheader;
compute name;
 n+1;
 if n=1 then call define(_row_,'style','style=header{fontsize=4 fontweight=blod}');
endcomp;
run;
ods pdf close;
SuryaKiran
Meteorite | Level 14

Thanks for your reply @Ksharp. This is what I exactly did, but thought there must be a easy option that I might be missing in ODS PDF or PROC REPORT. If I don't find an easy way, I will mark this a solution.  

Thanks,
Suryakiran
Ksharp
Super User
Yeah. I also want to know this option.
Maybe @Cynthia_sas know or talk to sas support .
Cynthia_sas
SAS Super FREQ
Hi, There is NOT any option. I showed the way to do it with 2 PROC REPORT steps. Otherwise, you need to fiddle with the data. For reports that are subject to regulatory constraints, fiddling with the data is not usually considered a viable option. There is nothing to ask Tech Support about this. There is NOT any option such as you envision.
Cynthia

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 6 replies
  • 1075 views
  • 4 likes
  • 3 in conversation