The SAS Output Delivery System and reporting techniques

Positioning issue with Proc Report in ODS Layout

Accepted Solution Solved
Reply
Regular Contributor
Posts: 179
Accepted Solution

Positioning issue with Proc Report in ODS Layout

Hi,

 

I'm trying to generate a 3 line entry in a Proc Report table going to a narrow table that is a bit constrained.  It will fit. But something is providing too large a top and bottom margin in the cell for it to display all 3 lines.

 

Test program & sample pdf attached.  What am I missing?

 

Thanks!!

 

--Ben


Accepted Solutions
Solution
‎01-11-2017 11:03 AM
SAS Super FREQ
Posts: 8,820

Re: Positioning issue with Proc Report in ODS Layout

Hi:
I think you'll have to go to Tech Support. The only way I made it fit was by fudging the sizes. If you look a the whole row, however, you are telling PROC REPORT that the cell for the SQUARE variable is 16pt -- that is twice the size of the cell for your BOILERPLATE variable. But, maybe you're "over controlling" the height. What happens if you leave your original region height of 2.75in, but take the HEIGHT= out of the style override completely? Right now, you have the interaction of both heights, plus font sizes conflicting. I'd recommend taking HEIGHT= out of the STYLE(COLUMN) first.

cynthia

View solution in original post


All Replies
SAS Super FREQ
Posts: 8,820

Re: Positioning issue with Proc Report in ODS Layout

Hi:
Was there code? I only see a PDF with your table. But no code.

Did you ask Tech Support already?
cynthia
Regular Contributor
Posts: 179

Re: Positioning issue with Proc Report in ODS Layout

Hi Cynthia,

 

That's odd. Thought I had attached it.  Obviously not. Smiley Happy

 

I hadn't asked TS yet on this one.  Was hoping it was something obvious I have missed.I seem to be having

 

I seem to be having problems attaching a file ending in .sas so I added it below.

 

--Ben

 

%let path=c:\temp\;

%let Tan    = CXE59005;
%let Tan2   = CXFAA72E;
%let Tan3   = CXFCBE64;
%let Tan4   = CXFCD49A;
%let Tan5   = CXFDE6C3;
%let Blue   = CX2B6BB0;

title;
* Generate fake data for testing;
data pcts;
input repid pct zip;
topzip+1;
if lag(repid)^=repid then topzip=1;
cards;
1 53 43058
1 17 43220
1 12 43235
1 7  43081
1 4  43214
;;;

ods escapechar='^';

options nodate nonumber nobyline orientation=landscape topmargin=.001in bottommargin=.001in leftmargin=.001in rightmargin=.001in;
ods html close ;

ods pdf file="&path.ziptablerpt.pdf" notoc;

ods layout absolute y=0in x=0in  width=10.98in height=8.48in;  * Define an absolute layout container with optional size parms;

ods region y=5in x=.5in width=1.5in height=2.75in style={background=cyan};

proc report data=pcts style(report)={cellpadding=0pt} style(column)={height=.32in} style(report)={borderwidth=0 cellpadding=1pct};
   by repid;

   column topzip square pct zip boilerplate;

   define topzip /display order noprint;
   define pct    /display noprint;
   define zip    /display noprint;

   define square /display computed       "«" right
                                         style(header)={font_size=16pt fontfamily='<ttf> Wingdings' vjust=m color=blue}
                                         style(column)={font_size=16pt width=.3in vjust=m just=c fontfamily='<ttf> Monotype Sorts'};
   define boilerplate /display computed  'You are located here' left
                                         style(header)={font_size=7pt }
                                         style(column)={font_size=7.5pt width=1.1in vjust=t background=grey};

   compute square /character length=10;
      square='n';
      if topzip=1 then call define('square','style',"style={color=&red}");
      if topzip=2 then call define('square','style',"style={color=&red2}");
      if topzip=3 then call define('square','style',"style={color=&red3}");
      if topzip=4 then call define('square','style',"style={color=&red4}");
      if topzip=5 then call define('square','style',"style={color=&red5}");
   endcomp;

   compute boilerplate/character length=120;
      boilerplate=cats(pct)||'% of your Regional^{newline 1}/Customers reside in ^S={color=blue}'||left(zip);
   endcomp;
run;

ods layout end;
ods pdf close;

Attachment
SAS Super FREQ
Posts: 8,820

Re: Positioning issue with Proc Report in ODS Layout

Hmmm. what's the difference between the &tan colors and the &red colors? Is there a disconnect in your code?
cynthia
SAS Super FREQ
Posts: 8,820

Re: Positioning issue with Proc Report in ODS Layout

Hi,

  I also see issues here -- not major, but conflicting cellpadding:

proc report data=pcts style(report)={cellpadding=0pt}
       style(column)={height=.32in}
       style(report)={borderwidth=0 cellpadding=1pct};

 

which one do you want. And then I see another issue with your style(column) -- have you multiplied out .32 * number of rows -- it might be enough space, but whether it is enough depends on the font size and cellpadding.

 

  Just some additional thoughts. Not in a place where I am able to run code.

 

cynthia

SAS Super FREQ
Posts: 8,820

Re: Positioning issue with Proc Report in ODS Layout

Hi:

  I think it is your HEIGHT values that need to be adjusted. Through fiddling I eventually got to this.

cynthia

 

ods_layout_size.png

Regular Contributor
Posts: 179

Re: Positioning issue with Proc Report in ODS Layout

Hi Cynthia,

 

Thanks for looking at it.  Yes, I can solve the issue by making the cells higher but it is fitting into a fixed section of a report and that's all the room it has.  Making it taller will run into other stuff.

 

See the space at the top of each cell in gray?  How do I get rid of that?  If that were eliminated it likely would all fit.

 

Much appreciated...

 

--Ben

Solution
‎01-11-2017 11:03 AM
SAS Super FREQ
Posts: 8,820

Re: Positioning issue with Proc Report in ODS Layout

Hi:
I think you'll have to go to Tech Support. The only way I made it fit was by fudging the sizes. If you look a the whole row, however, you are telling PROC REPORT that the cell for the SQUARE variable is 16pt -- that is twice the size of the cell for your BOILERPLATE variable. But, maybe you're "over controlling" the height. What happens if you leave your original region height of 2.75in, but take the HEIGHT= out of the style override completely? Right now, you have the interaction of both heights, plus font sizes conflicting. I'd recommend taking HEIGHT= out of the STYLE(COLUMN) first.

cynthia
Regular Contributor
Posts: 179

Re: Positioning issue with Proc Report in ODS Layout

Hi Cynthia,

 

That did it!  I was even able to increase the font size a hair for readability and it still all came out.

 

Thank you so much!

 

--Ben

☑ This topic is solved.

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

Discussion stats
  • 8 replies
  • 420 views
  • 1 like
  • 2 in conversation