09-22-2015 12:18 AM
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;
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" ;
ODS LAYOUT END;
I have spent much time goolgling the solution but failed...
09-22-2015 04:57 AM
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;
set tabulate_xyz (keep=var1 var2 a b c);
set tabulate_xyz (keep=var1 var2 d e f);
ods pdf file="xyz.pdf";
proc report data=report1 nowd;
proc report data=report2 nowd;
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.
09-22-2015 11:02 AM - edited 09-22-2015 11:05 AM
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.
09-22-2015 10:00 PM