The SAS Output Delivery System and reporting techniques

Stacking Tables in ODS PDF

Reply
Contributor
Posts: 24

Stacking Tables in ODS PDF

[ Edited ]

Hi,

 

My company is having me convert some quartly reports that are currently being run by SQL into SAS stored processes. I found a macro on a differnet community board that shows how to "glue" or stack your proc report output on top of each other, so it appears as if it is a single table. The article is here http://www2.sas.com/proceedings/sugi31/089-31.pdf. However, we need to use ods layout, which requires ods pdf, to get everything to fit on a single page. Does anyone know how to get this stacked table appearance using ods pdf? 

 

I guess another question would be, can ods layout allow me to get the tables close enough together so that they appear as one single table? 

 

Really any help is wanted. 

 

Thank you. 

SAS Super FREQ
Posts: 620

Re: Stacking Tables in ODS PDF

You can use ODS LAYOUT to do what you want. You just set the ROW_GUTTER=0, this should give you what you want.

 

Find below a sample code, make sure all the output fits on one page.

ods _all_ close;
options nocenter;

ods pdf file="c:\temp\sample.pdf" ;
ods layout gridded  columns=1 row_gutter=0;

ods region;
proc print data=sashelp.class;
  where sex = "F";
run;

ods region;
proc print data=sashelp.cars(obs=15);
  var make model type invoice Horsepower;
run;

ods region;
proc print data=sashelp.class;
  where sex = "M";
run;

ods layout end;
ods pdf close;

Bruno

Contributor
Posts: 24

Re: Stacking Tables in ODS PDF

Thank you. 

Contributor
Posts: 24

Re: Stacking Tables in ODS PDF

This works but I will need to use and absolute layout. Will this not work with an absolute layout?

SAS Super FREQ
Posts: 620

Re: Stacking Tables in ODS PDF

You can use absolute layout, but this means you have to know exactly the size of the region, that you are going to use, that will work with your data. If the region is too small, you will get a warning in the log, and region is not filled.

 

Sample code below shows how to use it.

ods _all_ close;
options nocenter;
ods pdf file="c:\temp\sample.pdf";
ods layout absolute;

%let tableHeight=6.63cm;

ods region x=0 y=0 width=8cm height=&tableHeight;

proc print data=sashelp.class
  style(table) = {width=100pct}
;
  where sex = "F";
run;

ods region x=0 y=&tableHeight width=8cm height=10cm;

proc print data=sashelp.class
  style(table) = {width=100pct}
;
  where sex = "M";
run;

ods layout end;
ods pdf close;

Bruno

Post a Question
Discussion Stats
  • 4 replies
  • 452 views
  • 0 likes
  • 2 in conversation