The SAS Output Delivery System and reporting techniques

tabulate row spacing

Super Contributor
Posts: 297

tabulate row spacing


I've a space constrained output that's being produced via ODS and proc tabulate. I'm finding that I could reduce the space between the various rows of data in the output table. I've looked at the ODS template (theme) and been overwhelmed by the options. Which option do I need to alter to reduce the between row spacing?

Posts: 9,365

Re: tabulate row spacing

Try the cellpadding= style override on the TABLE statement -- you may not have to move to a style template yet!
table ......./ style={cellpadding=2px};

You might also search the forum for a previous posting on creating very wide output -- there were quite a few suggestions in that posting, including cellpadding, and font_size changes.

The cellpadding style attribute controls the amount of "white" space around the letters and numbers in each data cell. If you reduce the cellpadding, you may eventually make the cellpadding too small, which won't be very readable.

If you are using ODS RTF or ODS PDF, you might consider changing the orientation to landscape:
options orientation=landscape; (before the ODS RTF or ODS PDF statements)

Super Contributor
Posts: 297

Re: tabulate row spacing

Posted in reply to Cynthia_sas
Thanks Cynthia;

I tried the cellpadding in the table statement as you suggested but it didn't seem to produce the desired effect.

Since then, I've moved to a different ods template and changed the cellpadding successfully.

proc template;
define style mytheme;
replace Body from Document
"Undef margins so we get the margins from the printer or SYS option"
bottommargin = 0.19in
topmargin = 0.19in
rightmargin = 0.20in
leftmargin = 0.20in;
replace Table from output/

The problem is that cellpadding reduces the white space on all four sides of the value. I only want to reduce the space between rows, not between columns. I increased the format to comma20.0 on the table statement, but the template seems to override that.

table Slab_Source_Dim_Cd=''*
(SLAB_GRD_FAM_NAME='' all) all*[style=[font_size=6.5pt font_weight=bold]],
(PROD_GRP_DIM_CD='' all) *invendate2=''*sum=' '
SLAB_LOC_DIM_CD="&sysdate, By Location" *
SLABTONs=' ' *sum=' '*format=comma20.0

How then do I reduce between row space independently of between column space?
Posts: 9,365

Re: tabulate row spacing

As you noted, ODS cellpadding style attribute is ALL the white space. The formatted width for a variable does not have an impact on ODS output -- only on LISTING window output. So your idea of using f=comma20. would NOT work in ODS HTML, RTF or PDF -- those destinations allot only the needed space for the number -- it does not pad the format width, as in Listing.

If your destination of choice is HTML, then you might be able to use CSS style properties by setting:
HTMLSTYLE='padding-top: 0px; padding-left: 3px; padding-right: 3px; padding-bottom: 0px;'

However, CSS style properties cannot be used for RTF and PDF in SAS 8 or 9.1.3. You may be able to use the new CSSSTYLE option in order to use a CSS style sheet with RTF and PDF in 9.2.

For more information on using the HTMLSTYLE attribute in a style template or a STYLE= override, refer to these sites: (shows a lot of HTMLSTYLE examples) (shows NOWRAP) (shows COLOR)

Ask a Question
Discussion stats
  • 3 replies
  • 2 in conversation