In tables generated by either PROC REPORT or PROC TABULATE, long values in the first row that wrap around cause the cell height for that row to be taller than the cell height for subsequent rows. This results in too much white space in the cell height of the first row. This issue occurs when routing output to ODS PDF.
To circumvent this issue, set an explicit and small CELLHEIGHT value for the first column. See the sample code in the Full Code section for an illustration.
Full Code
The sample code below generates four tables. The first tables generated with PROC REPORT and PROC TABULATE contain a long text string in the first row of the first column. This causes the cell height of the first row to contain too much white space. The workaround is to set a CELLHEIGHT value for the first variable, Question, in the DEFINE statement in PROC REPORT and in the CLASSLEV statement in PROC TABULATE.
Please note that the SPANROWS option is necessary in the PROC REPORT statement in order for the CELLHEIGHT style attribute to prove helpful.
proc format ;
value questionf
1='This is an example of a description that is too long so it wraps down to the next line';
run;
data a;
input question rater $ avg;
datalines;
1 manager 3
1 staff 2
1 peer 3
;
run;
ods listing close;
ods escapechar='^';
options nodate nonumber orientation=portrait;
ods pdf file='cellheight.pdf' notoc startpage=no;
title 'PROC REPORT and PROC TABULATE output with undesired behavior';
proc report data=a nowd spanrows;
column question rater avg;
define question / order
format=questionf.
style(column)={cellwidth=2.2in};
define rater / display;
define avg / display;
run;
proc tabulate data=a;
class question rater;
var avg;
format question questionf.;
table question*rater , avg*sum=' ';
classlev question / s={cellwidth=2.2in};
run;
ods pdf text='^S={textalign=c fontsize=13pt fontweight=bold fontstyle=italic}PROC REPORT and PROC TABULATE output with desired behavior';
proc report data=a nowd spanrows ;
column question rater avg;
define question / order
format=questionf.
style(column)={cellwidth=2.2in cellheight=.2in};
define rater / display;
define avg / display;
run;
proc tabulate data=a;
class question rater;
var avg;
format question questionf.;
table question*rater , avg*sum=' ';
classlev question / s={cellheight=.2in cellwidth=2.2in};
run;
ods pdf close;
ods listing;