BookmarkSubscribeRSS Feed
Cynthia_sas
SAS Super FREQ
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]
2 REPLIES 2
sravanpathu
Calcite | Level 5

Dear Cynthia,

I need a wide table containing 24 columns and 4 rows.

Problem is first column contains Grouping values it need wide width column and remaining need a same width.

Am doing across the 2 variable that is giving 24 column(12 from each).

am applying style in both across variable and grouping variable separately in define statement but group variable values are coming in three line

like below which need to present in single line

sravan

sravan

sravan

What i have to do no

and one more is

can we give single cell reference is sas

like _c2_6

_c2_ col

6 row

Cynthia_sas
SAS Super FREQ

Hi:

  SAS is not Excel. So if you are using CALL DEFINE for formatting, then you need to just:

CALL DEFINE('_c2_','style','style={attr=value}');

  But it's not clear to me that you are really talking about a CALL DEFINE, since you say you are using your style in an ACROSS item and a GROUP item DEFINE statement.

  Also, I don't understand what you mean when you say "but group variable values are coming in three line like below which need to present in single line"  -- because usually with GROUP items, if you have repetitious values, the repetitive ones are suppresses see screen shot for an example of what I mean. For REGION (a GROUP item), the EAST and WEST values are NOT repeated on every ROW. So I'm not sure how you are getting repeated values, as you describe.

  In addition, it would be better for you to start your own discussion thread in the ODS forum, instead of adding to a posting from 2006. I almost didn't read this one because it was so old, I thought there was a glitch in the forum. What you describe isn't really related to the forum posting I made. My forum posting was about how to change style attributes to squeeze more information on a page. Your question is about something that seems DATA and PROC REPORT specific -- not about styles.

  It is hard to provide you with constructive advice without seeing your code or your data or getting some idea of how your entire PROC REPORT program is coded, including the ODS statements which would indicate the destination you were interested in.

  For some suggestions about posting questions to the forum, have a look at this paper:

http://support.sas.com/resources/papers/proceedings12/189-2012.pdf

cynthia


how_group_val_suppressed.png

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 3391 views
  • 0 likes
  • 2 in conversation