Students frequently ask about how to deal with very wide tables (more than 10-12 columns. Like everything else with ODS, it depends on the destination!
If your destination of choice is HTML, then your tables can be as wide as you want them to be. Remember, however, that the browser controls printing of HTML pages, not SAS.
If your destination of choice is RTF or PDF, then some things to try are:
1) options orientation=landscape;
2) options orientation=landscape nocenter;
3) reduce the cellpadding style attribute value (cellpadding is the white space -inside- the cell walls)
4) reduce the font_size and/or change the font_face to a "narrow" font
5) fiddle with the margins
The program below shows what you get in RTF and PDF by just reducing the cellpadding value and varying the font_size value (fiddling with the margins is a whole 'nother post). The program generates a table with 25 character columns, then, it uses a macro program to change the font_size for every invocation of the macro. Scroll down in each output file to see the difference a font change makes.
Although the program uses Proc Report and style= statement level overrides, once you have your font_size of choice, you could then change the style template using the attribute values you like.
Cynthia
Here's the program:
[pre]
** 1) look at some examples of very wide reports;
** first, make some data;
data verywide;
array vw $10 vw1-vw25;
do grp = 'wombat', 'ocelot', 'koala';
if grp = 'ocelot' then do;
vw{1} = 'gggggggggg';
end;
else do;
vw{1} = 'pppppppppp';
end;
do i = 2 to 25 by 1;
if i le 12 then vw{i} = 'aaaaaaa'||put(i,z3.0);
else if i gt 12 then vw{i} = 'xxxxxxx'||put(i,z3.0);
end;
output verywide;
output verywide;
output verywide;
end;
run;
** next, set up a macro to run different fonts;
%macro smfont(fs=8pt);
title; footnote;
proc report data=verywide nowd
style(report)={font_face='Arial Narrow'
font_size=&fs cellpadding=2px}
style(header)={font_face='Arial Narrow' font_size=&fs}
style(column)={font_face='Arial Narrow'
font_size=&fs};
title "very wide report at font_size=&fs";
column grp vw1-vw25;
define grp/order;
run;
%mend;
** finally, use the macro and set orientation for;
** rtf and pdf;
** change the font 5 different times.;
** orientation has no effect on HTML;
ods listing close;
options nodate nonumber orientation=landscape;
ods html file='c:\temp\vw.html' style=sasweb;
ods rtf file='c:\temp\vw.rtf';
ods pdf file='c:\temp\vw.pdf';
%smfont(fs=12pt);
%smfont(fs=10.1pt);
%smfont(fs=8pt);
%smfont(fs=6pt);
%smfont(fs=4pt);
title; footnote;
ods _all_ close;
ods listing;
[/pre]
... View more