The SAS Output Delivery System and reporting techniques

ODS PDF and PROC REPORT - undesired border/spacing between columns

Accepted Solution Solved
Reply
New Contributor mpg
New Contributor
Posts: 2
Accepted Solution

ODS PDF and PROC REPORT - undesired border/spacing between columns

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;

test doc.PNG


Accepted Solutions
Solution
‎05-11-2015 06:47 PM
SAS Super FREQ
Posts: 8,815

Re: ODS PDF and PROC REPORT - undesired border/spacing between columns

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

View solution in original post


All Replies
Solution
‎05-11-2015 06:47 PM
SAS Super FREQ
Posts: 8,815

Re: ODS PDF and PROC REPORT - undesired border/spacing between columns

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

New Contributor mpg
New Contributor
Posts: 2

Re: ODS PDF and PROC REPORT - undesired border/spacing between columns

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

Super User
Posts: 9,856

Re: ODS PDF and PROC REPORT - undesired border/spacing between columns

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;  x.png

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 900 views
  • 0 likes
  • 3 in conversation