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.
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;
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
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.
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;
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.
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!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: