I have the same question that was only partially solved in the below post. Essentially, how can you get a space between the header and the beginning of the output data for proc report to ODS PDF (using SAS 9.4)
Similar to that post, just adding space below the header does not work, as I have a border at the bottom of the heading that is important.
The problem is that the solution from that post only puts a line after the header for the first page. But if the data spans multiple pages, then for the data on page2 and up, there is no blank line after the header and before the ouput.
This was the previous solution:
compute before;
line '';
endcomp;
Any thoughts? I've been killing myself trying to figure it out.
Thanks so much.
Some example data and the base code you are working with might help provide an example. Since headers can interact in a number of ways we need to see what you are attempting to create. I am not sure exactly where you want a space.
Did you try the other solution suggested by @PGStats:
You will need to use style option(s) in the proc report statement. Try adding option : style(header)=[paddingbottom=4mm].
You may want to try different values for the padding.
The problem with this solution is that it just adds space below the header, but before the border at the bottom of the header. I am looking to create space below the header border, but before the beginnig of the data. This is easy to do on page 1, but when the data being output spans multiple pages, then there is not a space on pages 2+.
Attached is a sample of my current output and below is my code.
%MACRO prints;
data _null_;
todate = today();
call symput('todate', put(todate, mmddyy10.));
run;
ods listing close;
ods pdf file = "C:\Users\xxx\Desktop\Test.pdf" pdftoc=1;
ods escapechar = '^';
options orientation=landscape nodate center nonumber nobyline;
proc report data=all4 center split='/' spanrows
style(report) = {font_face = 'timesnewroman'
outputwidth = 100%
outputheight = 100%
just = center
BORDERWIDTH=0
}
style(header) = {font_face = 'timesnewroman' font_size=10pt font_weight=medium
just=center bordertopcolor=black borderbottomcolor=black bordertopwidth=.1px borderbottomwidth=.1px
}
style(column) = {font_face = 'timesnewroman' font_size=9pt cellheight=13pt
};
title1 ;
title2 justify=left font='timesnewroman' height=10pt italic "Test Header Left" font='timesnewroman' height=10pt justify=right "Test Header Right";
title3 justify=left font='timesnewroman' height=10pt italic "Test Header Left 2" font='timesnewroman' height=10pt justify=right "Test Header Right 2";
title4 font='timesnewroman' height=10pt justify=right italic "&todate.";
title5 ;
title6 font='timesnewroman' bold height=14pt justify=center "This a a test Header Row";
title7 font='timesnewroman' bold height=12pt justify=center "Sample Row";
title8 font='timesnewroman' bold height=11pt justify=center "- #byval(Name) -";
by Name;
column Category Band Total Person1 Person2 Person1_Pct Person1_Match Person2_Pct Person2_Match Value;
define Category / order left style(column)=[font_weight=bold width=2.7in] style(header)=[just=left] 'Category';
define Band / display left style(column)=[width=1.7in] 'Band';
define Total / display center 'Total/People';
define Person1 / display center style(column)=[width=1.1in] 'Number of/People 1';
define Person2 / display center style(column)=[width=1.1in] 'Number of/People 2';
define Person1_Pct / display center style(column)=[width=1.1in] 'Percent of/People 1/in Band';
define Person2_Pct / display center style(column)=[width=1.1in] 'Percent of/People 2/in Band';
define Value / display center style(column)=[width=1.1in] 'Final Test Value/of the People';
define Person1_Match / display noprint;
define Person2_Match / display noprint;
compute Value;
if Value <= -3 then call define(_COL_,"style","style={font_weight=bold color=red font_size=10pt}");
endcomp;
compute Person1_Match;
if Person1_Match = 1 then call define('_c6_',"style","style={background=#e6e6e6}");
endcomp;
compute Person2_Match;
if Person2_Match = 1 then call define('_c8_',"style","style={background=#e6e6e6}");
endcomp;
compute after Category / Style={height=0.05in};
line ' ';
endcomp;
footnote1 "^S={outputwidth=100% bordertopcolor=black bordertopwidth=.1px font_face='timesnewroman' just=left vjust=bottom font_size=8pt font_weight=light cellheight=12pt} Note: This is a test footer, test test test.";
footnote2 ;
footnote3 ;
footnote4 justify=center height=9pt font='timesnewroman' 'Page ^{thispage} of ^{lastpage}';
run;
ods pdf close;
ods listing;
%MEND prints;
%prints;
use CALL DEFINE() to make the first row has a bigger 'cellheight=2cm' style ?
Thanks for the suggestion, but I'm not exactly sure how to make only the first row have a larger cell height? Also, won't this make the table look funny if one of the rows is a different size than the rest?
I have attached my sample output and code to another response above.
Thanks again for the help.
Sorry. I don't understand your question. Can you post the output you want see ? and the output you have now . compute before _PAGE_; line ''; endcomp;
I attached a pdf that shows the current output (1) and how I would like the ouput to be (2). This can also be seen in the atatched pdf from an earlier post that also contained my current code.
There are a few things I have found that provide a space on the first page, but not any subsequent pages. For instance if I change the following code to "before" instead of "after" it will insert a space on the first page, but not pages 2+.
compute after EEO_1_Category / Style={height=0.05in};
line ' ';
endcomp;
Also, the following will also put space between the header and the data on the first page, but not the other pages.
compute before;
line '';
endcomp;
Thanks.
Can you try " style={cellpadding=20px cellspacing=20px} ". A workaround way is making a GROUP variable to mark those obs belong to the same page, then use compute before GROUP; line ''; endcomp; Here is a paper I wrote before, You could refer to it to how to make a GROUP variable. http://support.sas.com/resources/papers/proceedings12/389-2012.pdf
Assuming there are 30 records in each page . data class; set sashelp.class sashelp.class(in=inb) sashelp.class(in=inc) sashelp.class(in=ind); if inb then do;if sex='F' then sex='S' ;else sex='D';end; if inc then do;if sex='F' then sex='G' ;else sex='E';end; if ind then do;if sex='F' then sex='A' ;else sex='V';end; run; proc sort data=class;by sex age;run; data air; set class; if mod(_n_,30)=1 then group+1; run; ods pdf file='c:\temp\x.pdf'; proc report data=air nowd; column group sex age weight height; define group/group noprint; define sex/order; define age/order; compute before group; line ' '; endcomp; break after group/page; run; ods pdf close;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.