<?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 proc sgplot/sgpanel boxplot with differnt colors? in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-sgpanel-boxplot-with-differnt-colors/m-p/124196#M4805</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I used sgplot and sgpanel to create boxplots...is there any way I can assign unique color to each boxplot? I tried going through GTL...but I couldn't figure it out.&lt;/P&gt;&lt;P&gt;I could color individual boxplots using proc boxplot without ods graphics, but I'm not able to use panels then.&lt;/P&gt;&lt;P&gt;How can I use panels in proc boxplot or color boxplots in proc sgpanel/sgplot?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/11882iF0100B14E1850A9E/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Untitled.png" title="Untitled.png" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 Oct 2013 17:31:54 GMT</pubDate>
    <dc:creator>jill</dc:creator>
    <dc:date>2013-10-25T17:31:54Z</dc:date>
    <item>
      <title>proc sgplot/sgpanel boxplot with differnt colors?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-sgpanel-boxplot-with-differnt-colors/m-p/124196#M4805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I used sgplot and sgpanel to create boxplots...is there any way I can assign unique color to each boxplot? I tried going through GTL...but I couldn't figure it out.&lt;/P&gt;&lt;P&gt;I could color individual boxplots using proc boxplot without ods graphics, but I'm not able to use panels then.&lt;/P&gt;&lt;P&gt;How can I use panels in proc boxplot or color boxplots in proc sgpanel/sgplot?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/11882iF0100B14E1850A9E/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Untitled.png" title="Untitled.png" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Oct 2013 17:31:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-sgpanel-boxplot-with-differnt-colors/m-p/124196#M4805</guid>
      <dc:creator>jill</dc:creator>
      <dc:date>2013-10-25T17:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot/sgpanel boxplot with differnt colors?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-sgpanel-boxplot-with-differnt-colors/m-p/124197#M4806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You want to change the color of each of the 4 boxes per panel, or of each panel to be consistent across the panel?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Oct 2013 18:05:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-sgpanel-boxplot-with-differnt-colors/m-p/124197#M4806</guid>
      <dc:creator>snoopy369</dc:creator>
      <dc:date>2013-10-25T18:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot/sgpanel boxplot with differnt colors?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-sgpanel-boxplot-with-differnt-colors/m-p/124198#M4807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;each of the 4 boxes per panel&lt;/P&gt;&lt;P&gt;ie. Assign a different color to each treatment group. similar to the graph attached(done by proc boxplot)&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/11925iC3EE5EEAE954FCD9/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Untitled2.png" title="Untitled2.png" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Oct 2013 18:22:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-sgpanel-boxplot-with-differnt-colors/m-p/124198#M4807</guid>
      <dc:creator>jill</dc:creator>
      <dc:date>2013-10-25T18:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot/sgpanel boxplot with differnt colors?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-sgpanel-boxplot-with-differnt-colors/m-p/124199#M4808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SGPANEL uses the data color list either from the template or from the DATACOLORS and DATACONTRASTCOLORS arguments in the SGPANEL.&amp;nbsp; So for example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ods html style=htmlblue path="c:\temp" gpath="c:\temp" file="mypanel.html";&lt;/P&gt;&lt;P&gt;proc sgpanel data=sashelp.prdsale;&lt;/P&gt;&lt;P&gt;panelby country;&lt;/P&gt;&lt;P&gt;styleattrs datacolors=(red green blue orange) datacontrastcolors=(green red orange blue);&lt;/P&gt;&lt;P&gt;vbox actual/group=prodtype;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;ods html close;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;produces red and green boxes with green and red bars.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or you can modify the colors in the style template.&amp;nbsp; By default they will have different colors so I'm not sure why yours don't - that must be an element of your style template, whichever you are using (either by default or by design).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Oct 2013 19:10:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-sgpanel-boxplot-with-differnt-colors/m-p/124199#M4808</guid>
      <dc:creator>snoopy369</dc:creator>
      <dc:date>2013-10-25T19:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot/sgpanel boxplot with differnt colors?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-sgpanel-boxplot-with-differnt-colors/m-p/124200#M4809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;vbox/hbox does not have 'group=' option. instead it has 'category=' option.&lt;/P&gt;&lt;P&gt;When I use group =option for other graphs (scatter, bar) the colors are assigned differently by default. However, for boxplot I'm unable to use group=option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is 'styleattrs' to be used as a statement or option? either way I'm getting syntax error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Oct 2013 19:41:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-sgpanel-boxplot-with-differnt-colors/m-p/124200#M4809</guid>
      <dc:creator>jill</dc:creator>
      <dc:date>2013-10-25T19:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot/sgpanel boxplot with differnt colors?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-sgpanel-boxplot-with-differnt-colors/m-p/124201#M4810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You must have SAS 9.2. Group support for box plots was added in SAS 9.3. Unfortunately, there is not a solution in SAS 9.2.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Oct 2013 19:50:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-sgpanel-boxplot-with-differnt-colors/m-p/124201#M4810</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2013-10-25T19:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot/sgpanel boxplot with differnt colors?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-sgpanel-boxplot-with-differnt-colors/m-p/124202#M4811</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmm, I'm using 9.4, so it's possible this is 9.4 code that won't work on whatever version you're on.&amp;nbsp; The above code works on 9.4.&amp;nbsp; On 9.3, styleattrs does not work, but group does (so the default htmlblue style gives red,blue,green,etc. colors).&amp;nbsp; You could still modify the graph colors in PROC TEMPLATE for whichever style you were using.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you're in 9.2, group doesn't work indeed; 9.2 was pretty early in the SG-procedures' lives and they didn't have a lot of the useful options they do today.&amp;nbsp; Perhaps one of the SAS folk will have a better answer for you in that case.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Either way I would recommend posting your version number in future questions about SGprocs (well, anything, but in particular SGprocs) as the version makes a huge difference in what they are capable of.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Oct 2013 19:51:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-sgpanel-boxplot-with-differnt-colors/m-p/124202#M4811</guid>
      <dc:creator>snoopy369</dc:creator>
      <dc:date>2013-10-25T19:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot/sgpanel boxplot with differnt colors?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-sgpanel-boxplot-with-differnt-colors/m-p/124203#M4812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As Dan and Snoopy have suggested, GTL and SG features were not fully fleshed out in SAS 9.2.&amp;nbsp; SAS 9.3 is better.&amp;nbsp; However, there is a way to get what you want with a little bit of work.&amp;nbsp; Transform your data from a "Group" structure to a "Multi-Variable" structure.&amp;nbsp; Then you can use the DISCRETEOFFSET option in GTL to get what you want.&amp;nbsp; Note, you have to some extra work to know how many unique group values you want, and set up the details yourself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attached is a simple example, where I have transformed the mpg_city by Type and Origin data for SASHELP.CARS into TYPE and 3 columns for MPG, one each for USA, Asia and Europe.&amp;nbsp; I did it the simple way using data step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, you can overlay three BOXPLOT statements, each with the right amount of DISCRETEOFFSET and BOXWIDTH to get what you want.&amp;nbsp; You have to use GTL as DISCRETEOFFSET was a late breaking option at 9.2 for just such use cases.&amp;nbsp; There was no time to add it to SGPLOT.&amp;nbsp; Colors come from style using CYCLEATTRS.&amp;nbsp; To change group colors, change the style.&amp;nbsp; See code and graph.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data trans;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set sashelp.cars(keep=origin type mpg_city where=(type ne 'Hybrid'));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; drop mpg_city;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if Origin eq 'USA' then USA=mpg_city;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if Origin eq 'Asia' then Asia=mpg_city;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if Origin eq 'Europe' then Europe=mpg_city;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc template;&lt;BR /&gt;&amp;nbsp; define statgraph BoxPlot;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; begingraph;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; entrytitle 'Mileage Distribution by Type and Origin';&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layout overlay / cycleattrs=true &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xaxisopts=(display=(ticks tickvalues))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yaxisopts=(label='Mileage');&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; boxplot x=type y=usa / discreteoffset=-0.25 boxwidth=0.2 name='a' legendlabel='USA';&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; boxplot x=type y=Asia / discreteoffset=0 boxwidth=0.2 name='b'&amp;nbsp; legendlabel='Asia';&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; boxplot x=type y=Europe / discreteoffset= 0.25 boxwidth=0.2 name='c'&amp;nbsp; legendlabel='Europe';&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; discretelegend 'a' 'b' 'c' / Title='Origin:';&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; endlayout;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; endgraph;&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ods listing;&lt;/P&gt;&lt;P&gt;proc sgrender data=trans template=BoxPlot;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="4455" alt="BoxPlotGroup_92M3.png" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/4455_BoxPlotGroup_92M3.png" width="450" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Oct 2013 21:17:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-sgpanel-boxplot-with-differnt-colors/m-p/124203#M4812</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2013-10-28T21:17:21Z</dc:date>
    </item>
  </channel>
</rss>

