BookmarkSubscribeRSS Feed
Fisher
Quartz | Level 8

I am trying to use ODS layout and region to display a wide table (with many columns) generated by proc tabulate. If ODS layout is not used, the wide table is automatically splitted into two pages with about half of columns displayed on each page. However, when I tried to use ODS layout and region, the second half of the table disappeared. I know ODS layout is pre_production feature in SAS 9.3, but I believe there must be still some ways to resolve it. 

 

My code is simple:

 

ODS PDF STARTPAGE=NOW;

goptions reset=all;

ODS LAYOUT START; 

   

ODS REGION x=0.001in y=1.4in width=20in; 

proc Tabulate data=myds;

      class var1 var2;

      table (var1="" ALL), (var2="" ALL )*(N="n" ) / BOX = "ALL"  ;      

   run;

ODS LAYOUT END;

 

I have spent much time goolgling the solution but failed... 

 

Thanks!!!

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

In my opinion, and I am sure others will disagree, I like to create a dataset which looks as close to the output product as possible and do minimal code in the proc report.  To this end you could just output the table from the proc tabulate, create two dataset from it, and then proc report those.  

proc tabulate data=xyz out=tabulate_xyz;

  class  var1 var2;

  ...

run;

data report1;

  set tabulate_xyz (keep=var1 var2 a b c);

run;

data report2;

  set tabulate_xyz (keep=var1 var2 d e f);

run;

 

ods pdf file="xyz.pdf";

proc report data=report1 nowd;

  columns _all_;

run;

proc report data=report2 nowd;

  columns _all_;

run;

ods pdf close;

 

Admittedly, this may be a little bit more code, however you then have the full flexibility of datastep SAS to do whatever you want with the data before reporting it.  Say you want to add percentages per block, add subheadings, add in your own page numbering etc.  

ballardw
Super User

You may also want to consider the style in effect when generating output. If you specify an ODS Style that uses smaller fonts than the default for PDF then your output may fit better, though there are obvious limits.

 

Also the page orientation, Landscape might help with wider tables.

 

 

 

Cynthia_sas
SAS Super FREQ
Hi:
I posted something a long time ago about very wide tables and how to make a very wide table fit on one landscape page by changing the font, the cellspacing and the cellpadding and changing the margins.

I would not use ODS LAYOUT yet until you exhaust all the options that are available in regular ODS. If you search for Very Wide tables, you should find my posting.

cynthia

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1370 views
  • 0 likes
  • 4 in conversation