SAS: How to use the ODS layout to place 8 charts on two pages of PDF?

I use SAS ODS to create PDF documents. The code below uses 4 graphics on 1 page. But if I try to put 8 graphics on 2 pages, all I get is 4 graphics on 1 page. I tried to copy the part between the asterisk lines and paste it again above the "ods pdf close"; but it didn’t work. I also tried adding "ods startpage = now;" between them, but that didn't work either. How can I put 8 graphs on 2 pages?

goptions reset=all; data test; input xy @@; datalines; 1 2 2 4 3 8 4 10 5 15 ; run; ods pdf file="[path]/output.pdf" ; **** ods layout Start width=10in height=8in ; ods region x=0 y=5% width=45% height=45%; proc gplot data=test; title2 'PLOT #1'; plot y*x /name="mygraph1" noframe; run; ods region x=55% y=5% width=45% height=45%; title2 'PLOT #2'; plot y*x /name="mygraph2" noframe; run; ods region x=0 y=51% width=45% height=45%; title2 'PLOT #3'; plot y*x / name="Mygraph3" noframe; run; ods region x=55% Y=51% width=45% height=45%; title2 'PLOT #4'; plot y*x / name="Mygraph4" noframe; run; quit; ods layout end; **** ods pdf close; 

The code is based on this article .

+7
source share
1 answer

The good question, in my opinion, is that it is VERY poorly documented anywhere.

You are almost there: you need to close the "container" layout, start a new page, and then open a new layout for the next page:

 ods pdf file="file.pdf" startpage=never; * page 1; ods layout start <dimensions>; ods region <dimensions>; proc whatever; run; ods region <dimensions>; proc whatever; run; ods layout end; *<etc. for page 1 content>; * start page 2; ods pdf startpage=now; * page 2; ods layout start <dimensions>; ods region <dimensions>; proc whatever; run; ods region <dimensions>; proc whatever; run; ods layout end; *<etc. for page 2 content>; ods pdf close; 
+4
source

All Articles