<?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: Legend order Proc sgplot hbar in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Legend-order-Proc-sgplot-hbar/m-p/167296#M6252</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What Sanjay was saying in the first item was that the order of the groups in the legend is determined by the order of the group values as they occur in the data. Therefore. if you use PROC SORT to sort your data by the group variable first, you should get the legend in the 0-2 order. If this is not the case, please let us know.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 Apr 2014 17:18:41 GMT</pubDate>
    <dc:creator>DanH_sas</dc:creator>
    <dc:date>2014-04-03T17:18:41Z</dc:date>
    <item>
      <title>Legend order Proc sgplot hbar</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Legend-order-Proc-sgplot-hbar/m-p/167293#M6249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've made a series of horizontal grouped (clustered) bar charts with proc sgplot. Is there a way to change the order of the legend? For some reason the legend is in reverse order from what is in the graph and in descending order. I know I can do it the way I want with proc gchart, but I'm just wondering if there is a way to do it with proc sgplot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="SGPlot.png" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/5892_SGPlot.png" width="450" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Apr 2014 16:08:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Legend-order-Proc-sgplot-hbar/m-p/167293#M6249</guid>
      <dc:creator>SB250</dc:creator>
      <dc:date>2014-04-03T16:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: Legend order Proc sgplot hbar</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Legend-order-Proc-sgplot-hbar/m-p/167294#M6250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Group values are in data order.&amp;nbsp; SAS 9.4 SGPLOT supports SORTORDER for legend.&amp;nbsp; SAS 9.3 SGPLOT does not have this feature. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have two options. &lt;/P&gt;&lt;P&gt;1 - Put the group values in the correct order in the data.&amp;nbsp; Or,&lt;/P&gt;&lt;P&gt;2 - use the TMPLOUT option to save the GTL template, and then in the DISCRETELEGEND statement, add SORTORDER= ASCENDINGFORMATTED | DESCENDINGFORMATTED.&amp;nbsp;&amp;nbsp;&amp;nbsp; Welcome to GTL. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Apr 2014 16:22:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Legend-order-Proc-sgplot-hbar/m-p/167294#M6250</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2014-04-03T16:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: Legend order Proc sgplot hbar</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Legend-order-Proc-sgplot-hbar/m-p/167295#M6251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure what you mean by the first option. I'm only referring to the order of the subgroup bars and the legend. The graph shows 0 on top, then 1 and 2. But the legend shows 2,1,0. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've never used GTL. I guess I will&amp;nbsp; probably just use proc gchart and have GTL on my list of things to learn &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Apr 2014 16:41:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Legend-order-Proc-sgplot-hbar/m-p/167295#M6251</guid>
      <dc:creator>SB250</dc:creator>
      <dc:date>2014-04-03T16:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: Legend order Proc sgplot hbar</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Legend-order-Proc-sgplot-hbar/m-p/167296#M6252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What Sanjay was saying in the first item was that the order of the groups in the legend is determined by the order of the group values as they occur in the data. Therefore. if you use PROC SORT to sort your data by the group variable first, you should get the legend in the 0-2 order. If this is not the case, please let us know.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Apr 2014 17:18:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Legend-order-Proc-sgplot-hbar/m-p/167296#M6252</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2014-04-03T17:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: Legend order Proc sgplot hbar</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Legend-order-Proc-sgplot-hbar/m-p/167297#M6253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My data is sorted in ascending order for the subgroup variable (var1) 0,1,2. It is strange.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I remove the GROUPDISPLAY=CLUSTER option, then I get the following chart. The legend is in the "correct" order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="SGPlot2.png" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/5907_SGPlot2.png" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I plot it as a vertical bar chart, the legend is also in the "correct" order. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="SGPlot.png" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/5908_SGPlot.png" width="450" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Apr 2014 17:40:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Legend-order-Proc-sgplot-hbar/m-p/167297#M6253</guid>
      <dc:creator>SB250</dc:creator>
      <dc:date>2014-04-03T17:40:54Z</dc:date>
    </item>
  </channel>
</rss>

