<?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 FREQ table and plot order are different in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-FREQ-table-and-plot-order-are-different/m-p/977834#M378529</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sas_order.png" style="width: 932px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/110953i2EAF097D3F65571D/image-size/large?v=v2&amp;amp;px=999" role="button" title="sas_order.png" alt="sas_order.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The table is ordered in decreasing frequency from top to bottom, but the plot is ordered in increasing frequency from bottom to top. I understand this is probably b/c the y axis value is increasing in that direction, but it still just looks suboptimal viewing the table and plot together. Is there any way to make the ordering between table and plot consistent? As a side question, even though I set a label, is there any way to not have the original variable name be used (and especially so prominently in the plot title) - there could be times when the original variable name is even uglier (eg, from ADaM/SDTM data). Here is my code&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;ods graphics on;
proc freq data=pg1.storm_final order=freq;
	tables StartDate / plots=freqplot(orient=horizontal scale=percent);
	format StartDate monname.;
	label StartDate='Storm Month';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Example data comes from this SAS course:&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://learn.sas.com/course/view.php?id=118" target="_blank" rel="noopener"&gt;https://learn.sas.com/course/view.php?id=118&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 26 Oct 2025 22:18:33 GMT</pubDate>
    <dc:creator>cluelesssas</dc:creator>
    <dc:date>2025-10-26T22:18:33Z</dc:date>
    <item>
      <title>PROC FREQ table and plot order are different</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-FREQ-table-and-plot-order-are-different/m-p/977834#M378529</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sas_order.png" style="width: 932px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/110953i2EAF097D3F65571D/image-size/large?v=v2&amp;amp;px=999" role="button" title="sas_order.png" alt="sas_order.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The table is ordered in decreasing frequency from top to bottom, but the plot is ordered in increasing frequency from bottom to top. I understand this is probably b/c the y axis value is increasing in that direction, but it still just looks suboptimal viewing the table and plot together. Is there any way to make the ordering between table and plot consistent? As a side question, even though I set a label, is there any way to not have the original variable name be used (and especially so prominently in the plot title) - there could be times when the original variable name is even uglier (eg, from ADaM/SDTM data). Here is my code&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;ods graphics on;
proc freq data=pg1.storm_final order=freq;
	tables StartDate / plots=freqplot(orient=horizontal scale=percent);
	format StartDate monname.;
	label StartDate='Storm Month';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Example data comes from this SAS course:&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://learn.sas.com/course/view.php?id=118" target="_blank" rel="noopener"&gt;https://learn.sas.com/course/view.php?id=118&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Oct 2025 22:18:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-FREQ-table-and-plot-order-are-different/m-p/977834#M378529</guid>
      <dc:creator>cluelesssas</dc:creator>
      <dc:date>2025-10-26T22:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FREQ table and plot order are different</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-FREQ-table-and-plot-order-are-different/m-p/977849#M378531</link>
      <description>&lt;P&gt;Are you sure you don't just want the months displayed in chronological order instead of by frequency?&amp;nbsp; Personally, I think that's going to confuse people.&amp;nbsp; In any case, I would use SGPLOT instead of tying yourself down with PROC FREQ:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=test noautolegend;
format startdate monname.;
vbar startdate / datalabel categoryorder=respasc;
xaxis label="Storm Month";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want it ordered chronologically, just remove the 'categoryorder' part.&amp;nbsp; And use HBAR rather than VBAR if you want the bars to be horizontal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Oct 2025 23:57:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-FREQ-table-and-plot-order-are-different/m-p/977849#M378531</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2025-10-26T23:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FREQ table and plot order are different</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-FREQ-table-and-plot-order-are-different/m-p/977857#M378532</link>
      <description>&lt;P&gt;I would assume it is because the coder that made the plot decided it looked better when the frequencies are in ascending order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that whoever made the code that makes that PLOT did so some 30 years after the table output was coded.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Oct 2025 01:25:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-FREQ-table-and-plot-order-are-different/m-p/977857#M378532</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-10-27T01:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FREQ table and plot order are different</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-FREQ-table-and-plot-order-are-different/m-p/977862#M378533</link>
      <description>&lt;P&gt;I check the DOC, there is not such option ORDER= in FREQPLOT.&lt;/P&gt;
&lt;P&gt;So the most convenient way is using PROC SGPLOT to replace the default graph of proc freq.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=sashelp.heart order=freq;
	tables bp_status ;
run;

title 'Whatever';
proc sgplot data=sashelp.heart;
hbar bp_status/stat=percent categoryorder=resdesc;
xaxis grid;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1761546386119.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/110971iFFF6BCECB560A114/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1761546386119.png" alt="Ksharp_0-1761546386119.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Oct 2025 06:26:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-FREQ-table-and-plot-order-are-different/m-p/977862#M378533</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-10-27T06:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FREQ table and plot order are different</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-FREQ-table-and-plot-order-are-different/m-p/977922#M378535</link>
      <description>&lt;P&gt;Thx KSharp.&lt;/P&gt;&lt;P&gt;Here is the code I ended up using (just a small nitpick that the LOG picked up: resdesc -&amp;gt; respdesc ie you forgot the p)&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;title 'Distribution of Storm Month';
proc sgplot data=pg1.storm_final;
	hbar StartDate/stat=percent categoryorder=respdesc;
	format StartDate monname.;
	label StartDate='Storm Month';
	xaxis grid;
run;
title;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The course I linked above advertised how you can assign temporary formats and labels within PROC steps. However in this case I need to use it in both FREQ and SGPLOT so I should probably move those to the DATA step&lt;/P&gt;</description>
      <pubDate>Mon, 27 Oct 2025 18:29:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-FREQ-table-and-plot-order-are-different/m-p/977922#M378535</guid>
      <dc:creator>cluelesssas</dc:creator>
      <dc:date>2025-10-27T18:29:17Z</dc:date>
    </item>
  </channel>
</rss>

