<?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: How to do a descending output in proc freq? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-descending-output-in-proc-freq/m-p/730509#M227469</link>
    <description>For a table with only a single variable, the order of highest frequency is the same order as highest percent since the denominator is consistent across all rows. &lt;BR /&gt;&lt;BR /&gt;So use ORDER=FREQ will give you the desired results. &lt;BR /&gt;&lt;BR /&gt;AFAIK, there isn't another way to control the order besides SORT and ORDER=DATA to use the data order.&lt;BR /&gt;</description>
    <pubDate>Wed, 31 Mar 2021 20:50:54 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-03-31T20:50:54Z</dc:date>
    <item>
      <title>How to do a descending output in proc freq?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-descending-output-in-proc-freq/m-p/730503#M227467</link>
      <description>&lt;P&gt;Hi all SAS Users,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Today I want to have the output that Percent is ranked descending.&lt;/P&gt;&lt;P&gt;My code is&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods noproctitle;
title' Categories of Reported Species ';
proc freq data=pg1.np_species;
tables Category/ nocum;&lt;/CODE&gt;&lt;/PRE&gt;&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="ResoluteCarbon_0-1617222907460.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56755i689B36E4F9DE7B27/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ResoluteCarbon_0-1617222907460.png" alt="ResoluteCarbon_0-1617222907460.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From what I learnt, if I want to have Frequency as descending, I can use option &lt;STRONG&gt;order=freq&lt;/STRONG&gt; on &lt;STRONG&gt;proc freq&lt;/STRONG&gt; data statement, if I want the order of Category as alphabet ascending, I just add nothing. But when I tried to rank the percent by descending, I cannot do that. I am wondering is there any option to do have the result that Percent will be ranked as descending without creating another &lt;STRONG&gt;proc sort&lt;/STRONG&gt; datastep?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;P/S: What I tried are:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;34         ods noproctitle;
35         title' Categories of Reported Species ';
36         proc freq data=pg1.np_species &lt;STRONG&gt;order=percent&lt;/STRONG&gt;;
                                               _______
                                               22
                                               76
ERROR 22-322: Syntax error, expecting one of the following: DATA, FORMATTED, FREQ, INTERNAL.  
ERROR 76-322: Syntax error, statement will be ignored.&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;34         ods noproctitle;
35         title' Categories of Reported Species ';


36         proc freq data=pg1.np_species;
37         tables descending Category/ nocum;
ERROR: Variable DESCENDING not found.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And could you please let me know why these two approaches are wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 20:38:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-descending-output-in-proc-freq/m-p/730503#M227467</guid>
      <dc:creator>ResoluteCarbon</dc:creator>
      <dc:date>2021-03-31T20:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a descending output in proc freq?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-descending-output-in-proc-freq/m-p/730507#M227468</link>
      <description>&lt;P&gt;According to the documentation,&amp;nbsp; you would use:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=pg1.np_species order=freq;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Mar 2021 20:48:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-descending-output-in-proc-freq/m-p/730507#M227468</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-03-31T20:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a descending output in proc freq?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-descending-output-in-proc-freq/m-p/730509#M227469</link>
      <description>For a table with only a single variable, the order of highest frequency is the same order as highest percent since the denominator is consistent across all rows. &lt;BR /&gt;&lt;BR /&gt;So use ORDER=FREQ will give you the desired results. &lt;BR /&gt;&lt;BR /&gt;AFAIK, there isn't another way to control the order besides SORT and ORDER=DATA to use the data order.&lt;BR /&gt;</description>
      <pubDate>Wed, 31 Mar 2021 20:50:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-descending-output-in-proc-freq/m-p/730509#M227469</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-31T20:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a descending output in proc freq?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-descending-output-in-proc-freq/m-p/730513#M227471</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this option only works with Frequency variable, not Percentage variable.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 20:55:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-descending-output-in-proc-freq/m-p/730513#M227471</guid>
      <dc:creator>ResoluteCarbon</dc:creator>
      <dc:date>2021-03-31T20:55:57Z</dc:date>
    </item>
  </channel>
</rss>

