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!!!
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.
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.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.