<?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: Descending order frequencies in proc freq (order=freq) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Descending-order-frequencies-in-proc-freq-order-freq/m-p/347609#M80328</link>
    <description>you could also mention the cumulative frequency variable in the proc sort depending on how you want to sort the data after proc freq</description>
    <pubDate>Thu, 06 Apr 2017 07:25:01 GMT</pubDate>
    <dc:creator>Jagadishkatam</dc:creator>
    <dc:date>2017-04-06T07:25:01Z</dc:date>
    <item>
      <title>Descending order frequencies in proc freq (order=freq)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Descending-order-frequencies-in-proc-freq-order-freq/m-p/347599#M80322</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=have order=freq ;
tables var1/list missing out=var1_freq;  
run;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The proc freq above outputs by descending order of frequency of var1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need the opposite, which is by ascending order.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the output only gives the frequency and percentage. How can I get the cumulative freq and cumulative percentage as well? These two should vary depending on how you order the var1.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2017 05:37:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Descending-order-frequencies-in-proc-freq-order-freq/m-p/347599#M80322</guid>
      <dc:creator>afiqcjohari</dc:creator>
      <dc:date>2017-04-06T05:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: Descending order frequencies in proc freq (order=freq)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Descending-order-frequencies-in-proc-freq-order-freq/m-p/347605#M80325</link>
      <description>to get the cumulative frequency and cumulative percent please mention OUTCUM in the tables&lt;BR /&gt;&lt;BR /&gt;proc freq data=have order=freq ;&lt;BR /&gt;tables var1/OUTCUM list missing out=var1_freq;  &lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;to sort the data by ascending frequency, use proc sort &lt;BR /&gt;&lt;BR /&gt;proc sort data=var1_freq;&lt;BR /&gt;by count;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Apr 2017 06:37:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Descending-order-frequencies-in-proc-freq-order-freq/m-p/347605#M80325</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2017-04-06T06:37:30Z</dc:date>
    </item>
    <item>
      <title>Re: Descending order frequencies in proc freq (order=freq)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Descending-order-frequencies-in-proc-freq-order-freq/m-p/347607#M80326</link>
      <description>Sorting after the proc freq won't work because the cumulative frequency is not 'sorted' accordingly.</description>
      <pubDate>Thu, 06 Apr 2017 07:11:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Descending-order-frequencies-in-proc-freq-order-freq/m-p/347607#M80326</guid>
      <dc:creator>afiqcjohari</dc:creator>
      <dc:date>2017-04-06T07:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: Descending order frequencies in proc freq (order=freq)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Descending-order-frequencies-in-proc-freq-order-freq/m-p/347609#M80328</link>
      <description>you could also mention the cumulative frequency variable in the proc sort depending on how you want to sort the data after proc freq</description>
      <pubDate>Thu, 06 Apr 2017 07:25:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Descending-order-frequencies-in-proc-freq-order-freq/m-p/347609#M80328</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2017-04-06T07:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: Descending order frequencies in proc freq (order=freq)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Descending-order-frequencies-in-proc-freq-order-freq/m-p/347643#M80352</link>
      <description>The cumulative frequency is calculated based on how the sorting is done. Sorting after won't do because the cumulative frequency no longer reflects the table properly.</description>
      <pubDate>Thu, 06 Apr 2017 10:02:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Descending-order-frequencies-in-proc-freq-order-freq/m-p/347643#M80352</guid>
      <dc:creator>afiqcjohari</dc:creator>
      <dc:date>2017-04-06T10:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: Descending order frequencies in proc freq (order=freq)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Descending-order-frequencies-in-proc-freq-order-freq/m-p/347769#M80419</link>
      <description>&lt;P&gt;&lt;EM&gt;Editor's Note: The documentation for PROC FREQ defines the ORDER=FREQ option as the &lt;STRONG&gt;descending&lt;/STRONG&gt; frequency count. Unfortunately, there is not an option to make this ascending. Other procedures, such as PROC REPORT, define ORDER=FREQ as the &lt;STRONG&gt;ascending&lt;/STRONG&gt; frequency count. However, given that the cumulative statistics are also desired, the PROC FREQ and DATA Step solution provided by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;is best for this case.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example input data and desired output will go a long way toward reducing suggestions that do not answer non-specified requirements. Your first post is change the order. And suggestions follow. After that you request that the cumulative totals be reordered, not in the initial post.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And when you start getting into non-standard behaviors then you get to do a little more work. Not much. Please see:&lt;/P&gt;
&lt;PRE&gt;proc freq data=sashelp.class noprint;
   tables age / out=agefreq;
run;

proc sort data=agefreq;
  by count;
run;

data want;
  set agefreq;&lt;BR /&gt;  cumcount + count;
  cumpercent + percent;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 18:28:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Descending-order-frequencies-in-proc-freq-order-freq/m-p/347769#M80419</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-08-31T18:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: Descending order frequencies in proc freq (order=freq)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Descending-order-frequencies-in-proc-freq-order-freq/m-p/347970#M80508</link>
      <description>Agree on providing the desired output. But I explicitly mentioned that the cumulative totals should be reordered according to the sort. So it was in the initial post.&lt;BR /&gt;&lt;BR /&gt;Otherwise I'm quite surprised that PROC FREQ can't have an option for that?&lt;BR /&gt;Furthermore, it's more common to perform cumulative frequency in ascending order as oppose to descending order. So I would expect that PROC Freq has a much simpler code for this.&lt;BR /&gt;&lt;BR /&gt;Nothing like this for example?&lt;BR /&gt;proc freq data=sashelp.class order= DESCENDING freq ;&lt;BR /&gt;tables age/OUTCUM list missing out=agefreq2;&lt;BR /&gt;run;&lt;BR /&gt;</description>
      <pubDate>Fri, 07 Apr 2017 01:30:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Descending-order-frequencies-in-proc-freq-order-freq/m-p/347970#M80508</guid>
      <dc:creator>afiqcjohari</dc:creator>
      <dc:date>2017-04-07T01:30:38Z</dc:date>
    </item>
  </channel>
</rss>

