<?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 sgpanel heatmap - sorting not working for legend in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgpanel-heatmap-sorting-not-working-for-legend/m-p/978637#M25717</link>
    <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="healmap_legend_2.PNG" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/111229i371D2043436A90E5/image-size/large?v=v2&amp;amp;px=999" role="button" title="healmap_legend_2.PNG" alt="healmap_legend_2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Changing sortorder from &lt;FONT color="#FF0000"&gt;descending&lt;/FONT&gt; to &lt;FONT color="#FF0000"&gt;reverseauto&lt;/FONT&gt; helped:&lt;BR /&gt;&lt;BR /&gt;keylegend / position=bottom title="Change from Baseline" sortorder=&lt;FONT color="#FF0000"&gt;reverseauto&lt;/FONT&gt;;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Nov 2025 02:32:38 GMT</pubDate>
    <dc:creator>Shain22</dc:creator>
    <dc:date>2025-11-11T02:32:38Z</dc:date>
    <item>
      <title>proc sgpanel heatmap - sorting not working for legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgpanel-heatmap-sorting-not-working-for-legend/m-p/978625#M25714</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have used proc sgpanel to create heatmap. Although have used&amp;nbsp;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;sortorder=descending&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;in the&amp;nbsp;keylegend statement, the legend is not sorted as per the expectation, i.e.&amp;nbsp; 4,3,2,1,0,-1,-2,-3,-4.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I have tried using proc sort with force option to sort the attrmap dataset, but that didn't help either.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Any help/suggestions would be much appreciated.&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;/* Define attribute map for CHG value colors */
data attrmap;
   length id $20 value 8 fillstyle $10 fillcolor $20;
   id='colormap';
   value=-4; fillstyle='solid'; fillcolor='DELG';     output;
   value=-3; fillstyle='solid'; fillcolor='VILG';     output;
   value=-2; fillstyle='solid'; fillcolor='BILG';     output;
   value=-1; fillstyle='solid'; fillcolor='LIGY';     output; /* brown */
   value= 0; fillstyle='solid'; fillcolor='white';    output;
   value= 1; fillstyle=&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="healmap_legend.PNG" style="width: 734px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/111226i038D38E86162DEFB/image-size/large?v=v2&amp;amp;px=999" role="button" title="healmap_legend.PNG" alt="healmap_legend.PNG" /&gt;&lt;/span&gt;'solid'; fillcolor='cxfca5a5'; output;
   value= 2; fillstyle='solid'; fillcolor='cxfb7171'; output;
   value= 3; fillstyle='solid'; fillcolor='RED';      output;
   value= 4; fillstyle='solid'; fillcolor='VIPK';     output;
run;
proc sgpanel data=out.HeatmapF noautolegend dattrmap=attrmap;
    panelby trt_label_sort / sort=descending layout=columnlattice onepanel colheaderpos=top novarname uniscale=row proportional;
    heatmapparm x=ordern y=paramcd_label colorgroup=CHG / attrid=colormap outline discretex discretey;
  keylegend / position=bottom title="Change from Baseline" &lt;FONT color="#FF0000"&gt;sortorder=descending&lt;/FONT&gt; ;

    colaxis grid label="Subject" valueattrs=(size=3.5);
    rowaxis min=0 max=200 label="       PART 2                                        PART 1 " reverse;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Nov 2025 22:31:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgpanel-heatmap-sorting-not-working-for-legend/m-p/978625#M25714</guid>
      <dc:creator>Shain22</dc:creator>
      <dc:date>2025-11-10T22:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgpanel heatmap - sorting not working for legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgpanel-heatmap-sorting-not-working-for-legend/m-p/978626#M25715</link>
      <description>&lt;P&gt;The easiest way to get what you want here is to add the following following line to your ATTRMAP data step and get rid of the sort option:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;retain show "attrmap";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will populate the legend with the values from the attributes map -- in the order you listed them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Mon, 10 Nov 2025 22:46:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgpanel-heatmap-sorting-not-working-for-legend/m-p/978626#M25715</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2025-11-10T22:46:41Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgpanel heatmap - sorting not working for legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgpanel-heatmap-sorting-not-working-for-legend/m-p/978634#M25716</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15130"&gt;@DanH_sas&lt;/a&gt;. I added the retain statement, but unfortunately still no change in the order on the legend.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Nov 2025 02:16:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgpanel-heatmap-sorting-not-working-for-legend/m-p/978634#M25716</guid>
      <dc:creator>Shain22</dc:creator>
      <dc:date>2025-11-11T02:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgpanel heatmap - sorting not working for legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgpanel-heatmap-sorting-not-working-for-legend/m-p/978637#M25717</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="healmap_legend_2.PNG" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/111229i371D2043436A90E5/image-size/large?v=v2&amp;amp;px=999" role="button" title="healmap_legend_2.PNG" alt="healmap_legend_2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Changing sortorder from &lt;FONT color="#FF0000"&gt;descending&lt;/FONT&gt; to &lt;FONT color="#FF0000"&gt;reverseauto&lt;/FONT&gt; helped:&lt;BR /&gt;&lt;BR /&gt;keylegend / position=bottom title="Change from Baseline" sortorder=&lt;FONT color="#FF0000"&gt;reverseauto&lt;/FONT&gt;;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Nov 2025 02:32:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgpanel-heatmap-sorting-not-working-for-legend/m-p/978637#M25717</guid>
      <dc:creator>Shain22</dc:creator>
      <dc:date>2025-11-11T02:32:38Z</dc:date>
    </item>
  </channel>
</rss>

