<?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: Order Y variable in PROC SGPANEL heat map in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Order-Y-variable-in-PROC-SGPANEL-heat-map/m-p/796066#M22590</link>
    <description>&lt;P&gt;Can you describe the order that you are getting?&lt;/P&gt;</description>
    <pubDate>Mon, 14 Feb 2022 14:54:35 GMT</pubDate>
    <dc:creator>DanH_sas</dc:creator>
    <dc:date>2022-02-14T14:54:35Z</dc:date>
    <item>
      <title>Order Y variable in PROC SGPANEL heat map</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Order-Y-variable-in-PROC-SGPANEL-heat-map/m-p/795988#M22588</link>
      <description>&lt;P&gt;So as not to repeat all the data, see this link:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/SGPANEL-heat-map-with-missing-cells/m-p/794901" target="_self"&gt;https://communities.sas.com/t5/SAS-Programming/SGPANEL-heat-map-with-missing-cells/m-p/794901&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The heatmap is working well, but my one remaining problem is the ordering of the variables on the Y axis of the heat map.&lt;/P&gt;
&lt;P&gt;The code as it now stands, is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC FORMAT;
	VALUE $ Subs
    'facebook'      =' 1 Facebook'
    'youtube'       =' 2 YouTube'
    'weather'       =' 3 weather'
    'cricket'       =' 4 cricket'
    'superannuat',
    'superannuation'=' 5 superannuation'
    'codeine'       =' 6 codeine'
    'mdma'          =' 7 MDMA'
    'fentanyl'      =' 8 fentanyl'
    'clenbuterol'   =' 9 clenbuterol'
    'modafinil'     ='10 modafinil'
    'pregabalin'    ='11 pregabalin'
	;
RUN;

%MACRO CommonCode(dset=);
DATA &amp;amp;dset.; SET &amp;amp;dset.; FORMAT _Substance Subs.;run;
proc print data=&amp;amp;dset.;run;
PROC SGPANEL
    NOAUTOLEGEND
    DATA=&amp;amp;dset.;
    PANELBY _Scale _Region /LAYOUT=LATTICE NOVARNAME ONEPANEL NOWALL NOBORDER;
    ROWAXIS DISPLAY=(NOLABEL) DISCRETEORDER=FORMATTED;
    COLAXIS DISPLAY=(NOLABEL) DISCRETEORDER=FORMATTED;
    HEATMAP X=SW_Signif1 Y=_Substance / COLORRESPONSE=PCT DISCRETEX DISCRETEY ;
    TEXT X=SW_Signif1 Y=_Substance TEXT=Pct;
    FORMAT Pct PERCENT8.2;
	TITLE "&amp;amp;dset.";
RUN;
%MEND CommonCode;
%CommonCode(dset=One);
%CommonCode(dset=Two);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have used numbers in the format to indicate the desired order (using this format and statements like&amp;nbsp;ORDER=FORMATTED in proc tabulate puts each item in the correct order).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The row axis and column axis of the panel are correctly ordered.&lt;/P&gt;
&lt;P&gt;The Y axis, however, is ordered in some weird way that I cannot discern.&lt;/P&gt;
&lt;P&gt;I have tried sorting the dataset, I have tried creating a numeric variable in the place of _Substance which reflects the correct order, neither of these worked.&lt;/P&gt;
&lt;P&gt;I cannot see anything in the help files that reflects a way to sort the heat map (for example, the&amp;nbsp;GROUPORDER=ASCENDING option with plots like VBOX).&lt;/P&gt;
&lt;P&gt;How can I get the Y axis values to appear in the order specified from the format?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have seen that if I change the uniscale= option (e.g., uniscale=row) on the panelby statement, I can change the order of the Y axis, but still not to reflect what I need.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 06:02:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Order-Y-variable-in-PROC-SGPANEL-heat-map/m-p/795988#M22588</guid>
      <dc:creator>JacquesR</dc:creator>
      <dc:date>2022-02-14T06:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: Order Y variable in PROC SGPANEL heat map</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Order-Y-variable-in-PROC-SGPANEL-heat-map/m-p/796043#M22589</link>
      <description>&lt;P&gt;Add REVERSE option:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%MACRO CommonCode(dset=);
DATA &amp;amp;dset.; SET &amp;amp;dset.; FORMAT _Substance Subs.;run;
PROC SGPANEL
    NOAUTOLEGEND
    DATA=&amp;amp;dset.;
    PANELBY _Scale _Region /LAYOUT=LATTICE NOVARNAME ONEPANEL NOWALL NOBORDER;
    ROWAXIS DISPLAY=(NOLABEL) DISCRETEORDER=FORMATTED &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;reverse&lt;/FONT&gt; &lt;/STRONG&gt;;
    COLAXIS DISPLAY=(NOLABEL) DISCRETEORDER=FORMATTED;
    HEATMAP X=SW_Signif1 Y=_Substance / COLORRESPONSE=PCT DISCRETEX DISCRETEY ;
    TEXT X=SW_Signif1 Y=_Substance TEXT=Pct;
    FORMAT Pct PERCENT8.2;
	TITLE "&amp;amp;dset.";
RUN;
%MEND CommonCode;
%CommonCode(dset=One)&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Feb 2022 13:45:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Order-Y-variable-in-PROC-SGPANEL-heat-map/m-p/796043#M22589</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-02-14T13:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: Order Y variable in PROC SGPANEL heat map</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Order-Y-variable-in-PROC-SGPANEL-heat-map/m-p/796066#M22590</link>
      <description>&lt;P&gt;Can you describe the order that you are getting?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 14:54:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Order-Y-variable-in-PROC-SGPANEL-heat-map/m-p/796066#M22590</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2022-02-14T14:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: Order Y variable in PROC SGPANEL heat map</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Order-Y-variable-in-PROC-SGPANEL-heat-map/m-p/796202#M22594</link>
      <description>&lt;P&gt;With quite some egg on my face, I have to admit that I realised today that part of my problem was the y axis fit policy. Once I increased the height of the axis, it was showing me what I wanted to see, with the Reverse option added.&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 05:02:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Order-Y-variable-in-PROC-SGPANEL-heat-map/m-p/796202#M22594</guid>
      <dc:creator>JacquesR</dc:creator>
      <dc:date>2022-02-15T05:02:23Z</dc:date>
    </item>
  </channel>
</rss>

