<?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 Re: multiple graph in a single output - SAS University Edition in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/multiple-graph-in-a-single-output-SAS-University-Edition/m-p/572503#M12340</link>
    <description>&lt;P&gt;Most of the approaches to single image will rely on a single data set to allow the procedure to generate image.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since your plots appear similar I would suspect one approach would be to&lt;/P&gt;
&lt;P&gt;1) &amp;nbsp;get the same x y variable names in each set&lt;/P&gt;
&lt;P&gt;2)&amp;nbsp; combine the data adding a variable to indicate which set each record comes from&lt;/P&gt;
&lt;P&gt;3) create a custom format to display the text for the Title statement as the values of a format for the data set indicator variable&lt;/P&gt;
&lt;P&gt;4) use SGPANEL with the combined data, use a PANELBY statement using the data set indicator variable with desired options,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; options would likely be Rows=2 Columns=2 ONEPANEL if you want a 2 by 2 layout.&lt;/P&gt;
&lt;P&gt;5) use COLAXISTABLE instead of xaxistable&lt;/P&gt;
&lt;P&gt;6) a COLAXIS statement that looks pretty similar to your XAXIS statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;use the custom format for the dataset indicator variable. That should become the label for each section of the panel graph.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Combining and renaming the data is not that difficult. Below is a generic example:&lt;/P&gt;
&lt;PRE&gt;data want ;
   set have1  (in=in1 rename=(abc=pdq) )
       have2  (in=in2 rename=(xyz=pdq) )
       have3  (in=in3 rename=(nom=pdq) )
       have4  (in=in4 rename=(bad=pdq) )
   ;
   indicator = sum(in1*1,in2*2,in3*3,in4*4);
run;&lt;/PRE&gt;
&lt;P&gt;The IN= option creates a temporary data set that has a value of 1 when the current data record is from that data set, 0 otherwise.&lt;/P&gt;
&lt;P&gt;The indicator uses the 0/1 information to create a variable with values from 1 to 4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this were my data I would likely have a Title that was something about "Patients at Risk" and only the first part of your current titles would go into the format.&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jul 2019 20:14:46 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-07-10T20:14:46Z</dc:date>
    <item>
      <title>multiple graph in a single output - SAS University Edition</title>
      <link>https://communities.sas.com/t5/New-SAS-User/multiple-graph-in-a-single-output-SAS-University-Edition/m-p/572487#M12334</link>
      <description>&lt;P&gt;Dear Friends&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to insert multiple graphs into a single image file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to learn template and sgrender .... but it is quite hostile for me!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anybody help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attach also the codes I used to create each single graph.&lt;/P&gt;&lt;P&gt;(up to now, I have to put them all together on photoshop...)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=survivalplotdata;
	step x=time y=survival / lineattrs=(pattern=solid thickness=2);
	xaxistable AtRisk / x=tAtRisk location=inside valueattrs=(size=10) 
		label='Patients at risk' labelattrs=(weight=bold);
	yaxis min=0 label='Probability' 
		labelattrs=(weight=bold);
	xaxis label='Years' labelattrs=(weight=bold);
	Title 'Actuarial survival';
	title2 'with patients at risk';
run;

proc sgplot data=cif_cvm;
	step x=Int_FU_Death y=CIF / lineattrs=(pattern=solid thickness=2);
	xaxistable AtRisk / x=tAtRisk location=inside valueattrs=(size=10) 
		label='Soggetti a rischio' labelattrs=(weight=bold);
	yaxis max=0.20 label='CIF estimate' 
		labelattrs=(weight=bold);
	xaxis label='Years' labelattrs=(weight=bold);
	Title 'Cumulative incidence function of CV mortality';
	title2 'with patients at risk';
run;

proc sgplot data=cif_m3;
	step x=Int_Fu_M3_Redo y=CIF / lineattrs=(pattern=solid thickness=2);
	xaxistable AtRisk / x=tAtRisk location=inside valueattrs=(size=10) 
		label='Patients at risk' labelattrs=(weight=bold);
	yaxis max=0.20 label='CIF estimate' 
		labelattrs=(weight=bold);
	xaxis label='Years' labelattrs=(weight=bold);
	Title 'Cumulative incidence function of MR ≥3+';
	title2 'with patients at risk';
run;

proc sgplot data=cif_redo;
	step x=Int_Fu_M3_Redo y=CIF / lineattrs=(pattern=solid thickness=2);
	xaxistable AtRisk / x=tAtRisk location=inside valueattrs=(size=10) 
		label='Patients at risk' labelattrs=(weight=bold);
	yaxis max=0.20 label='Cumulative incidence function' 
		labelattrs=(weight=bold);
	xaxis label='Years' labelattrs=(weight=bold);
	Title 'Cumulative incidence function of reoperation';
	title2 'with patients at risk';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Jul 2019 19:14:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/multiple-graph-in-a-single-output-SAS-University-Edition/m-p/572487#M12334</guid>
      <dc:creator>antor82</dc:creator>
      <dc:date>2019-07-10T19:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: multiple graph in a single output - SAS University Edition</title>
      <link>https://communities.sas.com/t5/New-SAS-User/multiple-graph-in-a-single-output-SAS-University-Edition/m-p/572491#M12336</link>
      <description>How do you want those images combined? Have you tried using the TMPLOUT option in PROC SGPLOT to get your template code?</description>
      <pubDate>Wed, 10 Jul 2019 19:32:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/multiple-graph-in-a-single-output-SAS-University-Edition/m-p/572491#M12336</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-10T19:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: multiple graph in a single output - SAS University Edition</title>
      <link>https://communities.sas.com/t5/New-SAS-User/multiple-graph-in-a-single-output-SAS-University-Edition/m-p/572497#M12339</link>
      <description>1) I would like to combine them in a L2R2 layout&lt;BR /&gt;&lt;BR /&gt;2) actually I haven’t tried the TMPLOUT option yet&lt;BR /&gt;&lt;BR /&gt;Tks in advance&lt;BR /&gt;&lt;BR /&gt;A&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Jul 2019 19:54:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/multiple-graph-in-a-single-output-SAS-University-Edition/m-p/572497#M12339</guid>
      <dc:creator>antor82</dc:creator>
      <dc:date>2019-07-10T19:54:19Z</dc:date>
    </item>
    <item>
      <title>Re: multiple graph in a single output - SAS University Edition</title>
      <link>https://communities.sas.com/t5/New-SAS-User/multiple-graph-in-a-single-output-SAS-University-Edition/m-p/572503#M12340</link>
      <description>&lt;P&gt;Most of the approaches to single image will rely on a single data set to allow the procedure to generate image.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since your plots appear similar I would suspect one approach would be to&lt;/P&gt;
&lt;P&gt;1) &amp;nbsp;get the same x y variable names in each set&lt;/P&gt;
&lt;P&gt;2)&amp;nbsp; combine the data adding a variable to indicate which set each record comes from&lt;/P&gt;
&lt;P&gt;3) create a custom format to display the text for the Title statement as the values of a format for the data set indicator variable&lt;/P&gt;
&lt;P&gt;4) use SGPANEL with the combined data, use a PANELBY statement using the data set indicator variable with desired options,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; options would likely be Rows=2 Columns=2 ONEPANEL if you want a 2 by 2 layout.&lt;/P&gt;
&lt;P&gt;5) use COLAXISTABLE instead of xaxistable&lt;/P&gt;
&lt;P&gt;6) a COLAXIS statement that looks pretty similar to your XAXIS statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;use the custom format for the dataset indicator variable. That should become the label for each section of the panel graph.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Combining and renaming the data is not that difficult. Below is a generic example:&lt;/P&gt;
&lt;PRE&gt;data want ;
   set have1  (in=in1 rename=(abc=pdq) )
       have2  (in=in2 rename=(xyz=pdq) )
       have3  (in=in3 rename=(nom=pdq) )
       have4  (in=in4 rename=(bad=pdq) )
   ;
   indicator = sum(in1*1,in2*2,in3*3,in4*4);
run;&lt;/PRE&gt;
&lt;P&gt;The IN= option creates a temporary data set that has a value of 1 when the current data record is from that data set, 0 otherwise.&lt;/P&gt;
&lt;P&gt;The indicator uses the 0/1 information to create a variable with values from 1 to 4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this were my data I would likely have a Title that was something about "Patients at Risk" and only the first part of your current titles would go into the format.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 20:14:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/multiple-graph-in-a-single-output-SAS-University-Edition/m-p/572503#M12340</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-07-10T20:14:46Z</dc:date>
    </item>
    <item>
      <title>Re: multiple graph in a single output - SAS University Edition</title>
      <link>https://communities.sas.com/t5/New-SAS-User/multiple-graph-in-a-single-output-SAS-University-Edition/m-p/572531#M12346</link>
      <description>&lt;P&gt;Dear Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got the template from TMPLOUT= option.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question now is:&lt;/P&gt;&lt;P&gt;How could I join together 4 template codes from 4 different dataset files?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 21:11:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/multiple-graph-in-a-single-output-SAS-University-Edition/m-p/572531#M12346</guid>
      <dc:creator>antor82</dc:creator>
      <dc:date>2019-07-10T21:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: multiple graph in a single output - SAS University Edition</title>
      <link>https://communities.sas.com/t5/New-SAS-User/multiple-graph-in-a-single-output-SAS-University-Edition/m-p/572536#M12347</link>
      <description>You'll still have to combine the files as indicated by BallardW - that's an issue I hadn't caught in my original question. I'm wondering if ODS DOCUMENT wouldn't be easier? Just to clarify you don't want a PDF with a single page with all 4 graphs, you definitely want all as a PNG/JPEG file?</description>
      <pubDate>Wed, 10 Jul 2019 21:38:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/multiple-graph-in-a-single-output-SAS-University-Edition/m-p/572536#M12347</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-10T21:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: multiple graph in a single output - SAS University Edition</title>
      <link>https://communities.sas.com/t5/New-SAS-User/multiple-graph-in-a-single-output-SAS-University-Edition/m-p/572537#M12348</link>
      <description>I'm trying to combine these files, keeping only the variables of interests.&lt;BR /&gt;Yes, the final format should be png/jpeg.</description>
      <pubDate>Wed, 10 Jul 2019 21:41:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/multiple-graph-in-a-single-output-SAS-University-Edition/m-p/572537#M12348</guid>
      <dc:creator>antor82</dc:creator>
      <dc:date>2019-07-10T21:41:06Z</dc:date>
    </item>
  </channel>
</rss>

