<?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: PROC SGPLOT Attrid and Format label Interactions in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-Attrid-and-Format-label-Interactions/m-p/415712#M14278</link>
    <description>&lt;P&gt;Use the formatted group values in your dattrmap dataset, sort your data by your numeric variable, and use grouporder=data in the hbar statement.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Nov 2017 23:03:12 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2017-11-22T23:03:12Z</dc:date>
    <item>
      <title>PROC SGPLOT Attrid and Format label Interactions</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-Attrid-and-Format-label-Interactions/m-p/415688#M14275</link>
      <description>&lt;P&gt;I am trying to use the SGPLOT procedure to create a stacked horizontal bar chart with four categories and apply a color scheme using the attrid statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In order to get the four categories in the proper order (rather than alphabetical), each category was assigned a numeric variable (1-4) and a format statement is used to convert the numeric variable back into the category label.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue is that I can either get the format to work but the attrid statement won't work to assign the appropriate colors or the attrid statement works to assign the colors and I am left with (1,2,3,4) in my legend.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first statement produces an output with the appropriate values for label but not the colors specified by the evh type&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=combined5 dattrmap=formatdw.evhstyle;
format value valfmt.;
hbar &amp;amp;sumvar. / response=pcs1 stat=sum
group=value groupdisplay=stack nooutline attrid=evh;
title "Primary Care Services by Type";
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAS2.JPG" style="width: 364px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/16809i8F00CD2A92492510/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAS2.JPG" alt="SAS2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The second statement produces a graph with the appropriate colors but leaves (1,2,3,4) in the legend as the values used to order the stacked bars&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=combined5 dattrmap=formatdw.evhstyle;
hbar &amp;amp;sumvar. / response=pcs1 stat=sum
group=value groupdisplay=stack nooutline attrid=evh;
title "Primary Care Services by Type";
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sas1.JPG" style="width: 364px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/16810iC0F76B4D44648E71/image-size/large?v=v2&amp;amp;px=999" role="button" title="sas1.JPG" alt="sas1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Ideally, I'd like the bars stacked in the proper order, with the color scheme applied and the service types labeled in the legend. Thanks in advance for any help.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2017 21:56:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-Attrid-and-Format-label-Interactions/m-p/415688#M14275</guid>
      <dc:creator>Ewilliamson</dc:creator>
      <dc:date>2017-11-22T21:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT Attrid and Format label Interactions</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-Attrid-and-Format-label-Interactions/m-p/415707#M14276</link>
      <description>&lt;P&gt;I don't know the answer, and there is not enough code here for me to easily reconstruct what you are doing.&amp;nbsp; However, I can say that one of the standard legend tricks is to make an invisible plot that has the legend you want and overlay it with a visible plot that makes the graph that you want (and don't show the legend for it).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, in either the latest release or the second latest, there is a legenditem statement that is very cool and lets you control precisely what is in the legend.&amp;nbsp; If no one posts better ideas, you might try those.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2017 22:42:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-Attrid-and-Format-label-Interactions/m-p/415707#M14276</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2017-11-22T22:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT Attrid and Format label Interactions</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-Attrid-and-Format-label-Interactions/m-p/415709#M14277</link>
      <description>It would be helpful if you can replicate this using a SASHELP table or provide some sample data so we can test solutions rather than make some generic suggestions.</description>
      <pubDate>Wed, 22 Nov 2017 22:48:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-Attrid-and-Format-label-Interactions/m-p/415709#M14277</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-22T22:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT Attrid and Format label Interactions</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-Attrid-and-Format-label-Interactions/m-p/415712#M14278</link>
      <description>&lt;P&gt;Use the formatted group values in your dattrmap dataset, sort your data by your numeric variable, and use grouporder=data in the hbar statement.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2017 23:03:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-Attrid-and-Format-label-Interactions/m-p/415712#M14278</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-11-22T23:03:12Z</dc:date>
    </item>
  </channel>
</rss>

