<?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 RANK order by descending in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-RANK-order-by-descending/m-p/737430#M229891</link>
    <description>&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;It doesn't work well.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Please describe the issue; "does not work" is meaningless when looking for help. This option works as described.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Apr 2021 21:00:29 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2021-04-27T21:00:29Z</dc:date>
    <item>
      <title>PROC RANK order by descending</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-RANK-order-by-descending/m-p/737183#M229788</link>
      <description>&lt;P&gt;I have a question about using PROC RANK function.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I usually use SQL in the company however I need to edit SAS query as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem :&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to express below SQL query in SAS&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;RANK() OVER (PARTITION BY GROUP_NAME ORDER BY START_DATE DESC) AS SEQ &amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried below query but I need to make a rank based on START_DATE order by descending.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anybody can give the answer of it, please let me know.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROC RANK
DATA = WORK.DATA_EXTRACTION1
OUT = WORK.DATA_EXTRACTION2;
BY GROUP_NAME;
VAR START_DATE;
RANKS SEQ;
RUN; &amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 07:57:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-RANK-order-by-descending/m-p/737183#M229788</guid>
      <dc:creator>Zooyeon</dc:creator>
      <dc:date>2021-04-27T07:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: PROC RANK order by descending</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-RANK-order-by-descending/m-p/737189#M229793</link>
      <description>&lt;P&gt;Sadly &lt;A href="https://communities.sas.com/t5/SASware-Ballot-Ideas/Add-window-functions-in-SAS-SQL/idi-p/462556" target="_self"&gt;window functions&lt;/A&gt; are not supported yet in SAS.&lt;/P&gt;
&lt;P&gt;Have you tried the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p16s2o8e4bnqrin1phywxdaxqba7.htm#p1o4x5q2nuqqx1n1kjks8hktpy5o" target="_self"&gt;descending &lt;/A&gt;option for proc rank?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 08:36:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-RANK-order-by-descending/m-p/737189#M229793</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-04-27T08:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: PROC RANK order by descending</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-RANK-order-by-descending/m-p/737227#M229814</link>
      <description>Thanks for your quick reply &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;Then where should I put descending option in the SAS quary that I posted?&lt;BR /&gt;I tried put it anywhere I can put it, but It doesn't work well.</description>
      <pubDate>Tue, 27 Apr 2021 11:33:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-RANK-order-by-descending/m-p/737227#M229814</guid>
      <dc:creator>Zooyeon</dc:creator>
      <dc:date>2021-04-27T11:33:20Z</dc:date>
    </item>
    <item>
      <title>Re: PROC RANK order by descending</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-RANK-order-by-descending/m-p/737236#M229818</link>
      <description>&lt;P&gt;You will have to add a sort step to get the required order, as the DESCENDING option only controls how the ranks are assigned, but not how the output is sorted.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort
  data=sashelp.class
  out=class
;
by sex;
run;

proc rank
  data=class 
  out=want
  ties=low
;
by sex;
var age;
ranks age_rank;
run;

proc sort data=want;
by sex descending age_rank;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Apr 2021 12:26:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-RANK-order-by-descending/m-p/737236#M229818</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-04-27T12:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: PROC RANK order by descending</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-RANK-order-by-descending/m-p/737430#M229891</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;It doesn't work well.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Please describe the issue; "does not work" is meaningless when looking for help. This option works as described.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 21:00:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-RANK-order-by-descending/m-p/737430#M229891</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-04-27T21:00:29Z</dc:date>
    </item>
  </channel>
</rss>

