7

I am using SAS ODS to create PDF documents. The code below works to put 4 graphs on 1 page. But if I try to put 8 graphs on 2 pages, all I get is 4 graphs on 1 page. I tried copying the part between the lines of asterixes and pasting it again above "ods pdf close;" but that didn't work. I also tried adding "ods startpage = now;" between the two, but that didn't work either. How can I put 8 graphs on 2 pages?

goptions reset=all;

data test;
input x y @@;
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.

Joe
  • 62,789
  • 6
  • 49
  • 67
BB1
  • 95
  • 2
  • 4

1 Answers1

4

Good question, in my opinion this is something that is VERY poorly documented anywhere.

You're nearly there: you need to close your layout "container", force a new page, 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;
sasfrog
  • 2,410
  • 1
  • 17
  • 28
  • I'm trying to do this with tables, but when I use "startpage=no" the titles for the tables after the first on the page don't appear. Do you have a solution for this? – Akos Nov 26 '15 at 23:50
  • I found an answer to my problem; in case anyone encounters the same thing: as startpage=no means only one set of titles is printed on one page, you can use the text= option for including titles between tables or graphs. http://support.sas.com/techsup/notes/v8/8/044.html – Akos Nov 27 '15 at 01:02