<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Multiple graphs per in PDF page in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Multiple-graphs-per-in-PDF-page/m-p/604868#M175414</link>
    <description>&lt;P&gt;I would like to output multiple graphs to PDF. For now, I draw my graphs using a macro that outputs 3 graphs (this number can be changed to 5 or 6). I run this macro several times for different datasets.&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I would like to achieve is to have each PDF page contain 3 graphs from the macro.&lt;/P&gt;&lt;P&gt;So far, I have tried this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ibm intel microsoft; set sashelp.stocks;
	if stock='IBM' then output IBM;
	if stock='Intel' then output Intel;
	if stock='Microsoft' then output Microsoft;
run;
%macro graph(data);
	proc sgplot data=&amp;amp;data.;title "&amp;amp;data. : open";series x=date y=open;run;
	proc sgplot data=&amp;amp;data.;title "&amp;amp;data. : close";series x=date y=close;run;
	proc sgplot data=&amp;amp;data.;title "&amp;amp;data. : volume";series x=date y=volume;run;
%mend;
ods _all_ close; 

ods pdf file = "test.pdf" startpage=never ;

ods layout gridded rows=2 columns=2 column_widths=(3.75in 3.75in);
	ods region;
	ods graphics / height=3in width=3.5in;;
	%graph(ibm);

	ods region;
	ods graphics / height=3in width=3.5in;;
	%graph(intel);

	ods region;
	ods graphics / height=3in width=3.5in;;
	%graph(microsoft);

	ods region;
	ods graphics / height=3in width=3.5in;;
	%graph(ibm);

ods layout end;
ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Which is not really what I want because it puts&amp;nbsp;the 3 graphs from the macro on 1 side of the&amp;nbsp;page, and other 3 from running the macro again&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, I don't know why there is a title on each page.&lt;/P&gt;&lt;P&gt;What have I done wrong? and what if the macro returns 5 graphs? In this case, I would still want to have 4 per page, and the next page would contain only the fifth graph. graphs from running the macro will start on a new page.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Nov 2019 02:07:08 GMT</pubDate>
    <dc:creator>somebody</dc:creator>
    <dc:date>2019-11-18T02:07:08Z</dc:date>
    <item>
      <title>Multiple graphs per in PDF page</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multiple-graphs-per-in-PDF-page/m-p/604868#M175414</link>
      <description>&lt;P&gt;I would like to output multiple graphs to PDF. For now, I draw my graphs using a macro that outputs 3 graphs (this number can be changed to 5 or 6). I run this macro several times for different datasets.&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I would like to achieve is to have each PDF page contain 3 graphs from the macro.&lt;/P&gt;&lt;P&gt;So far, I have tried this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ibm intel microsoft; set sashelp.stocks;
	if stock='IBM' then output IBM;
	if stock='Intel' then output Intel;
	if stock='Microsoft' then output Microsoft;
run;
%macro graph(data);
	proc sgplot data=&amp;amp;data.;title "&amp;amp;data. : open";series x=date y=open;run;
	proc sgplot data=&amp;amp;data.;title "&amp;amp;data. : close";series x=date y=close;run;
	proc sgplot data=&amp;amp;data.;title "&amp;amp;data. : volume";series x=date y=volume;run;
%mend;
ods _all_ close; 

ods pdf file = "test.pdf" startpage=never ;

ods layout gridded rows=2 columns=2 column_widths=(3.75in 3.75in);
	ods region;
	ods graphics / height=3in width=3.5in;;
	%graph(ibm);

	ods region;
	ods graphics / height=3in width=3.5in;;
	%graph(intel);

	ods region;
	ods graphics / height=3in width=3.5in;;
	%graph(microsoft);

	ods region;
	ods graphics / height=3in width=3.5in;;
	%graph(ibm);

ods layout end;
ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Which is not really what I want because it puts&amp;nbsp;the 3 graphs from the macro on 1 side of the&amp;nbsp;page, and other 3 from running the macro again&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, I don't know why there is a title on each page.&lt;/P&gt;&lt;P&gt;What have I done wrong? and what if the macro returns 5 graphs? In this case, I would still want to have 4 per page, and the next page would contain only the fifth graph. graphs from running the macro will start on a new page.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 02:07:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multiple-graphs-per-in-PDF-page/m-p/604868#M175414</guid>
      <dc:creator>somebody</dc:creator>
      <dc:date>2019-11-18T02:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple graphs per in PDF page</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multiple-graphs-per-in-PDF-page/m-p/605128#M175543</link>
      <description>&lt;P&gt;The Title output you get multiple times because EACH proc call will display the current title statements in effect at that time.&lt;/P&gt;
&lt;P&gt;So if you only want a title to appear before one plot then (dummy code)&lt;/P&gt;
&lt;PRE&gt;Title "Title statement";

proc sgplot data= ..
   &amp;lt;plot statements&amp;gt;
run;

Title; /* this turns of the title for the next plot call*/

proc sgplot data= ..
   &amp;lt;plot statements&amp;gt;
run;

proc sgplot data= ..
   &amp;lt;plot statements&amp;gt;
run;
&lt;/PRE&gt;
&lt;P&gt;You may also want to investigate the ODS PDF option Nogtitle to place the title into the PDF portion of the output instead of in the graphs.&lt;/P&gt;
&lt;P&gt;Your demonstrated code will generate 12 plots but you talk about wanting each page to contain 3 graphs but do not tell us which 3 graphs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It sounds like you may want to insert ODS PDF Startpage=NOW statements at some point, either between macro calls or between the SGPLOT statements but I'm not sure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Again dummy code to create a new page before each macro plot call. I remove the layout stuff as I am not sure what you actually are attempting. Your layout settings may be part of your issue with the pagination desire.&lt;/P&gt;
&lt;PRE&gt;ods pdf file = "test.pdf" startpage=never ;

	ods graphics / height=3in width=3.5in;;
	%graph(ibm);
ODS PDF Startpage=now;
	
	ods graphics / height=3in width=3.5in;;
	%graph(intel);

ODS PDF Startpage=now;

	
	ods graphics / height=3in width=3.5in;;
	%graph(microsoft);

ODS PDF Startpage=now;
	
	ods graphics / height=3in width=3.5in;;
	%graph(ibm);

ods pdf close;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 18:01:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multiple-graphs-per-in-PDF-page/m-p/605128#M175543</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-11-18T18:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple graphs per in PDF page</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Multiple-graphs-per-in-PDF-page/m-p/608613#M177157</link>
      <description>&lt;P&gt;Thank you for your reply. I tried your suggestions and it works with starting a new PDF page for each macro graph. However, it does not stack the graphs together to have 2x2 graphs per pdf page. It returns 4 graphs (1x4). Would you have any idea on how to spread these 4 graphs into 2 columns?&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 02:36:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Multiple-graphs-per-in-PDF-page/m-p/608613#M177157</guid>
      <dc:creator>somebody</dc:creator>
      <dc:date>2019-12-02T02:36:13Z</dc:date>
    </item>
  </channel>
</rss>

