<?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 Combining boxplots with greplay in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Combining-boxplots-with-greplay/m-p/67659#M2327</link>
    <description>I want to combine boxplots on a same graph using greplay and display it in the output window. &lt;BR /&gt;
I have been able to combine the plots in a catalog:&lt;BR /&gt;
&lt;BR /&gt;
proc boxplot data=comp2 gout=CatComp;&lt;BR /&gt;
	plot dm1*a1;&lt;BR /&gt;
	plot dm2*a2;&lt;BR /&gt;
                plot dm3*a3;&lt;BR /&gt;
                plot dm4*a4;&lt;BR /&gt;
run;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
But have not been able to combine the plots. Any suggestions please?&lt;BR /&gt;
Thanks.</description>
    <pubDate>Tue, 01 Feb 2011 11:49:16 GMT</pubDate>
    <dc:creator>VD</dc:creator>
    <dc:date>2011-02-01T11:49:16Z</dc:date>
    <item>
      <title>Combining boxplots with greplay</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Combining-boxplots-with-greplay/m-p/67659#M2327</link>
      <description>I want to combine boxplots on a same graph using greplay and display it in the output window. &lt;BR /&gt;
I have been able to combine the plots in a catalog:&lt;BR /&gt;
&lt;BR /&gt;
proc boxplot data=comp2 gout=CatComp;&lt;BR /&gt;
	plot dm1*a1;&lt;BR /&gt;
	plot dm2*a2;&lt;BR /&gt;
                plot dm3*a3;&lt;BR /&gt;
                plot dm4*a4;&lt;BR /&gt;
run;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
But have not been able to combine the plots. Any suggestions please?&lt;BR /&gt;
Thanks.</description>
      <pubDate>Tue, 01 Feb 2011 11:49:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Combining-boxplots-with-greplay/m-p/67659#M2327</guid>
      <dc:creator>VD</dc:creator>
      <dc:date>2011-02-01T11:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: Combining boxplots with greplay</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Combining-boxplots-with-greplay/m-p/67660#M2328</link>
      <description>You have the various graphs in the catalog and now you need to replay them?  Take a look at &lt;A href="http://sfew.websitetoolbox.com/post?id=2239498" target="_blank"&gt;http://sfew.websitetoolbox.com/post?id=2239498&lt;/A&gt;.  The top page was produced via greplay after having produced the 6 component graphs into a catalog as you have done.  The tricky part had to do with producing the individual graphs and hiding / displaying their axes depending on where they would end up on the master page..&lt;BR /&gt;
&lt;BR /&gt;
Hope this helps to get you started,&lt;BR /&gt;
wd</description>
      <pubDate>Wed, 09 Feb 2011 14:32:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Combining-boxplots-with-greplay/m-p/67660#M2328</guid>
      <dc:creator>Bill</dc:creator>
      <dc:date>2011-02-09T14:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: Combining boxplots with greplay</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Combining-boxplots-with-greplay/m-p/67661#M2329</link>
      <description>Bill,&lt;BR /&gt;
&lt;BR /&gt;
Many thanks for the lead.&lt;BR /&gt;
&lt;BR /&gt;
V</description>
      <pubDate>Wed, 09 Feb 2011 16:25:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Combining-boxplots-with-greplay/m-p/67661#M2329</guid>
      <dc:creator>VD</dc:creator>
      <dc:date>2011-02-09T16:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: Combining boxplots with greplay</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Combining-boxplots-with-greplay/m-p/67662#M2330</link>
      <description>here's another idea if the various box plots can reasonably share a common y-axis&lt;BR /&gt;
&lt;BR /&gt;
it rearranges data from the data set SASHELP.PRDSAL2 so you can display three&lt;BR /&gt;
different box plots all in one PROC BOXPLOT ... three different variables used on the&lt;BR /&gt;
the x-axis ...you have 4, a1-a4&lt;BR /&gt;
&lt;BR /&gt;
you also have 4 different y-vars, but you can also rename dm1-dm4 to a common name&lt;BR /&gt;
and combine the data as I do here&lt;BR /&gt;
&lt;BR /&gt;
maybe this is 'overkill', but it does get three different variables ... or three separate boxplots ...&lt;BR /&gt;
all into one PNG file&lt;BR /&gt;
&lt;BR /&gt;
*&lt;BR /&gt;
use a SASHELP data set&lt;BR /&gt;
rearrange the data for use in PROC BOXPLOT&lt;BR /&gt;
the PUT statements show the values to use in PROC FORMAT&lt;BR /&gt;
;&lt;BR /&gt;
&lt;BR /&gt;
proc sort data=sashelp.prdsal2 (keep=country actual) out=co;&lt;BR /&gt;
by country;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data co;&lt;BR /&gt;
set co;&lt;BR /&gt;
by country;&lt;BR /&gt;
group + first.country;&lt;BR /&gt;
if first.country then put country=;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc sort data=sashelp.prdsal2 (keep=prodtype actual) out=pr;&lt;BR /&gt;
by prodtype;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data pr;&lt;BR /&gt;
set pr;&lt;BR /&gt;
by prodtype;&lt;BR /&gt;
group + first.prodtype;&lt;BR /&gt;
if first.prodtype then put prodtype=;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc sort data=sashelp.prdsal2 (keep=year actual) out=yr;&lt;BR /&gt;
by year;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data yr;&lt;BR /&gt;
set yr;&lt;BR /&gt;
by year;&lt;BR /&gt;
group + first.year;&lt;BR /&gt;
if first.year then put year=;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
* combine all the data sets;&lt;BR /&gt;
&lt;BR /&gt;
data all;&lt;BR /&gt;
set co (in=c) pr(in=p) yr(in=y);&lt;BR /&gt;
if c then name = 'Country';&lt;BR /&gt;
else&lt;BR /&gt;
if p then do; &lt;BR /&gt;
    group+4;&lt;BR /&gt;
	name = 'Type';&lt;BR /&gt;
end;&lt;BR /&gt;
else do;&lt;BR /&gt;
    group+7;&lt;BR /&gt;
	name = 'Year';&lt;BR /&gt;
end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
* specify labels for the x-axis (based on groups shown in the LOG after running data step;&lt;BR /&gt;
&lt;BR /&gt;
proc format;&lt;BR /&gt;
value group&lt;BR /&gt;
1 = 'Canada'&lt;BR /&gt;
2 = 'Mexico'&lt;BR /&gt;
3 = 'USA'&lt;BR /&gt;
5 = 'Furniture'&lt;BR /&gt;
6 = 'Office'&lt;BR /&gt;
8 = '1995'&lt;BR /&gt;
9 = '1996'&lt;BR /&gt;
10 = '1997'&lt;BR /&gt;
11 = '1998'&lt;BR /&gt;
4,7 = '   '&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
* create a PNG file;&lt;BR /&gt;
&lt;BR /&gt;
goptions reset=all ftext='calibri' htext=3 gunit=pct &lt;BR /&gt;
         dev=png xpixels=2000 ypixels=1500 gsfname=gout;&lt;BR /&gt;
&lt;BR /&gt;
axis1 value=(a=45 h=2) label=none major=none;&lt;BR /&gt;
&lt;BR /&gt;
* add some white space around the plot;&lt;BR /&gt;
&lt;BR /&gt;
title1 ls=2;&lt;BR /&gt;
title2 ls=1 a=90;&lt;BR /&gt;
title3 ls=1 a=-90;&lt;BR /&gt;
footnote1 ls=1;&lt;BR /&gt;
&lt;BR /&gt;
filename gout 'z:\box.png';&lt;BR /&gt;
&lt;BR /&gt;
proc boxplot data=all;&lt;BR /&gt;
plot actual * group (name) / continuous boxstyle=schematic haxis=axis1;&lt;BR /&gt;
format group group.;&lt;BR /&gt;
run;</description>
      <pubDate>Thu, 10 Feb 2011 17:13:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Combining-boxplots-with-greplay/m-p/67662#M2330</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2011-02-10T17:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: Combining boxplots with greplay</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Combining-boxplots-with-greplay/m-p/67663#M2331</link>
      <description>If you have SAS 9.2 maintanence 3, there is an another alternative. You can use the Graph Template Language (GTL) to overlay the boxes and offset them so that they do not collide. Here's an example:&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc template;&lt;BR /&gt;
define statgraph boxplot;&lt;BR /&gt;
begingraph;&lt;BR /&gt;
layout overlay / cycleattrs=true yaxisopts=(label="Dimensions (in mm)";&lt;BR /&gt;
  boxplot x=species y=sepallength / discreteoffset=-0.2 boxwidth=0.2 &lt;BR /&gt;
          name="sl" legendlabel="Sepal Length";&lt;BR /&gt;
  boxplot x=species y=sepalwidth / boxwidth=0.2 &lt;BR /&gt;
          name="sw" legendlabel="Sepal Width";&lt;BR /&gt;
  boxplot x=species y=petallength / discreteoffset=0.2 boxwidth=0.2 &lt;BR /&gt;
          name="pl" legendlabel="Petal Length";&lt;BR /&gt;
  discretelegend "sl" "sw" "pl";&lt;BR /&gt;
endlayout;&lt;BR /&gt;
endgraph;&lt;BR /&gt;
end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc sgrender data=sashelp.iris template=boxplot; run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Hope this helps!&lt;BR /&gt;
Dan</description>
      <pubDate>Thu, 10 Feb 2011 17:50:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Combining-boxplots-with-greplay/m-p/67663#M2331</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2011-02-10T17:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: Combining boxplots with greplay</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Combining-boxplots-with-greplay/m-p/67664#M2332</link>
      <description>Mike and Dan, &lt;BR /&gt;
Many thanks for the detailed solutions. &lt;BR /&gt;
Much appreciated!&lt;BR /&gt;
V</description>
      <pubDate>Fri, 11 Feb 2011 16:06:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Combining-boxplots-with-greplay/m-p/67664#M2332</guid>
      <dc:creator>VD</dc:creator>
      <dc:date>2011-02-11T16:06:08Z</dc:date>
    </item>
  </channel>
</rss>

