Hello,
I am trying to use PROC REPORT and ODS PDF to generate a stylized report with alternate row highlighting. There is a gap or white border appearing between columns on the rows and the summary border that I cannot figure out how to get rid of, despite playing with various BORDERWIDTH and BORDERSPACING options. The spacing does not appear when I run only the PROC REPORT code and view the output in the Results Viewer, but it does appear in the PDF (see attached file). Any thoughts on what I'm doing wrong?
Thanks in advance.
OPTIONS NODATE NONUMBER NOCENTER NOBYLINE TOPMARGIN="1IN" BOTTOMMARGIN="1IN" LEFTMARGIN="1IN" RIGHTMARGIN="1IN" MISSING=' ';
ODS ESCAPECHAR='^';
ODS PDF FILE="&MPGDRIVE\TEST DOC.PDF" UNIFORM NOTOC;
ODS PDF STARTPAGE=NO;
PROC REPORT DATA=SASHELP.COMPANY NOWINDOWS HEADLINE MISSING
style(report)={outputwidth=100% rules=none frame=void borderspacing=0}
style(header)={borderwidth=0 borderspacing=0 backgroundcolor=cx990000 color=white font_size=16pt font_face='Franklin Gothic Demi Cond'}
style(column)={borderwidth=0 borderspacing=0 font_size=12pt font_face='Franklin Gothic Medium Cond'}
style(summary)={borderspacing=0 bordertopwidth=2 bordertopcolor=black font_size=16pt font_face='Franklin Gothic Demi Cond'};
COLUMN ('Level 3' LEVEL3) LEVEL2,N;
DEFINE LEVEL3 / GROUP '' STYLE(COLUMN)=[CELLWIDTH=3.4IN borderspacing=0];
COMPUTE LEVEL3;
COUNT+1;
IF (MOD(COUNT,2)) THEN CALL DEFINE(_ROW_, 'STYLE','STYLE=[BACKGROUND=#FFCCCC borderspacing=0]');
IF _BREAK_='_RBREAK_' THEN CALL DEFINE('LEVEL3','style','style=[pretext="Total"]');
IF _BREAK_='_RBREAK_' THEN CALL DEFINE(_ROW_, 'STYLE','STYLE=[BACKGROUND=#FFFFFF]');
ENDCOMP;
DEFINE LEVEL2 / ACROSS '' STYLE(COLUMN)=[borderspacing=0];
DEFINE N / '' FORMAT=COMMA8.0 STYLE(COLUMN)=[CELLWIDTH=1IN borderspacing=0];
RBREAK AFTER / SUMMARIZE;
RUN;
ODS PDF CLOSE;
Hi:
I'd really recommend working with Tech Support on this. Generally, when I see PDF inserting extra space, it happens because I am trying to "overcontrol" the widths of the columns So what happens if you take out either the outputwidth=100% or the hard-coded cellwidth of 1in for the N statistic? My guess is that those 2 width specifications are somehow colliding and PDF doesn't know how to draw the table. But that is just a guess. Tech Support would be able to help with a more definitive answer.
cynthia
Hi:
I'd really recommend working with Tech Support on this. Generally, when I see PDF inserting extra space, it happens because I am trying to "overcontrol" the widths of the columns So what happens if you take out either the outputwidth=100% or the hard-coded cellwidth of 1in for the N statistic? My guess is that those 2 width specifications are somehow colliding and PDF doesn't know how to draw the table. But that is just a guess. Tech Support would be able to help with a more definitive answer.
cynthia
Cynthia,
Thanks so much for the suggestion about overcontrolling the formatting. I removed the outputwidth part, and the extra spacing was gone!
Thanks again,
Mike
Once I remove CELLWIDTH=3.4IN and CELLWIDTH=1IN . I get the right result .
OPTIONS NODATE NONUMBER NOCENTER NOBYLINE TOPMARGIN="1IN" BOTTOMMARGIN="1IN" LEFTMARGIN="1IN" RIGHTMARGIN="1IN" MISSING=' ';
ODS ESCAPECHAR='^';
ODS PDF FILE="c:\temp\DOC.PDF" UNIFORM NOTOC;
ODS PDF STARTPAGE=NO;
PROC REPORT DATA=SASHELP.COMPANY NOWINDOWS HEADLINE MISSING
style(report)={outputwidth=100% rules=none frame=void borderspacing=0}
style(header)={borderwidth=0 borderspacing=0 backgroundcolor=cx990000 color=white font_size=16pt font_face='Franklin Gothic Demi Cond'}
style(column)={borderwidth=0 borderspacing=0 font_size=12pt font_face='Franklin Gothic Medium Cond'}
style(summary)={borderspacing=0 bordertopwidth=2 bordertopcolor=black font_size=16pt font_face='Franklin Gothic Demi Cond'};
COLUMN ('Level 3' LEVEL3) LEVEL2,N;
DEFINE LEVEL3 / GROUP '' STYLE(COLUMN)=[ borderspacing=0];
COMPUTE LEVEL3;
COUNT+1;
IF (MOD(COUNT,2)) THEN CALL DEFINE(_ROW_, 'STYLE','STYLE=[BACKGROUND=#FFCCCC borderspacing=0]');
IF _BREAK_='_RBREAK_' THEN CALL DEFINE('LEVEL3','style','style=[pretext="Total"]');
IF _BREAK_='_RBREAK_' THEN CALL DEFINE(_ROW_, 'STYLE','STYLE=[BACKGROUND=#FFFFFF]');
ENDCOMP;
DEFINE LEVEL2 / ACROSS '' STYLE(COLUMN)=[borderspacing=0];
DEFINE N / '' FORMAT=COMMA8.0 STYLE(COLUMN)=[borderspacing=0];
RBREAK AFTER / SUMMARIZE;
RUN;
ODS PDF CLOSE;
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: