<?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 Using proc rank in a multiple group by in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Using-proc-rank-in-a-multiple-group-by/m-p/471760#M70940</link>
    <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to rank some data using Proc Rank and a group by clause but to be honest I don't even know where to start.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. The 4 ranking columns should use the&amp;nbsp; following group by clauses to define their ranking&lt;/P&gt;&lt;P&gt;2. The ranking should stay the same if the group by clause returns the exact same result&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;rank_ftp &amp;gt;&lt;/STRONG&gt; group by system_id, reporting_date, ftp&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;rank_preprocess &amp;gt;&lt;/STRONG&gt; group by system_id, reporting_date, preprocess&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;rank_calculation &amp;gt;&lt;/STRONG&gt; group by system_id, reporting_date, calculation&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;rank_synchronisation &amp;gt;&lt;/STRONG&gt; group by system_id, reporting_date, synchronisation&lt;/SPAN&gt;&lt;/P&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="Ranking help.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21290i3B5A30693C79D1B5/image-size/large?v=v2&amp;amp;px=999" role="button" title="Ranking help.JPG" alt="Ranking help.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Until now I came up with this (for the ftp part), but it gives me rank 0 for everything.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=WORK.LFS_VAA_BC_TMP out=work.sorted;
   by system_id reporting_date;
run;


proc rank data=WORK.sorted out=work.rankings;
   var   ftp;
   ranks rank_ftp;
   by  system_id reporting_date;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Jun 2018 16:04:22 GMT</pubDate>
    <dc:creator>MihaiViju2</dc:creator>
    <dc:date>2018-06-20T16:04:22Z</dc:date>
    <item>
      <title>Using proc rank in a multiple group by</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-proc-rank-in-a-multiple-group-by/m-p/471760#M70940</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to rank some data using Proc Rank and a group by clause but to be honest I don't even know where to start.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. The 4 ranking columns should use the&amp;nbsp; following group by clauses to define their ranking&lt;/P&gt;&lt;P&gt;2. The ranking should stay the same if the group by clause returns the exact same result&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;rank_ftp &amp;gt;&lt;/STRONG&gt; group by system_id, reporting_date, ftp&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;rank_preprocess &amp;gt;&lt;/STRONG&gt; group by system_id, reporting_date, preprocess&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;rank_calculation &amp;gt;&lt;/STRONG&gt; group by system_id, reporting_date, calculation&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;rank_synchronisation &amp;gt;&lt;/STRONG&gt; group by system_id, reporting_date, synchronisation&lt;/SPAN&gt;&lt;/P&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="Ranking help.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21290i3B5A30693C79D1B5/image-size/large?v=v2&amp;amp;px=999" role="button" title="Ranking help.JPG" alt="Ranking help.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Until now I came up with this (for the ftp part), but it gives me rank 0 for everything.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=WORK.LFS_VAA_BC_TMP out=work.sorted;
   by system_id reporting_date;
run;


proc rank data=WORK.sorted out=work.rankings;
   var   ftp;
   ranks rank_ftp;
   by  system_id reporting_date;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 16:04:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-proc-rank-in-a-multiple-group-by/m-p/471760#M70940</guid>
      <dc:creator>MihaiViju2</dc:creator>
      <dc:date>2018-06-20T16:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: Using proc rank in a multiple group by</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-proc-rank-in-a-multiple-group-by/m-p/471769#M70941</link>
      <description>&lt;P&gt;Can you include some data so we can replicate your issue?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/164458"&gt;@MihaiViju2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&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="Ranking help.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21290i3B5A30693C79D1B5/image-size/large?v=v2&amp;amp;px=999" role="button" title="Ranking help.JPG" alt="Ranking help.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Until now I came up with this (for the ftp part), but it gives me rank 0 for everything.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your results also show a rank of 1/2 so I'm confused. SAS does the ranks from 0 to the number of groups. You didn't specify a ranking methodology either, what type of ranks do you want to calculate? Break it into deciles, quartlies, groups of 3?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 16:11:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-proc-rank-in-a-multiple-group-by/m-p/471769#M70941</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-20T16:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: Using proc rank in a multiple group by</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-proc-rank-in-a-multiple-group-by/m-p/472034#M70968</link>
      <description>&lt;P&gt;I added the data in the excel sheet. If you remove the ranking columns then you have the data I am working on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A bit of background story:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is an ETL processing street framework. Basicaly a DSR file comes in via ftp then is preprocessed then calculated and then synchronized. For every failed attempt to load the file, a new record is created with the new attempt. The failure can occur anywhere in the chain. So in my case I have rank 1 everywhere for ftp because I am always using the same file. If a new file should be delivered then the ranking will be 2 (as long as the system_id and reporting_date are the same).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My unique identifiers are the system_id and reporting_date. The ranking should start again from 1 when a new file is delivered or a new reporting_date is encountered.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 10:44:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-proc-rank-in-a-multiple-group-by/m-p/472034#M70968</guid>
      <dc:creator>MihaiViju2</dc:creator>
      <dc:date>2018-06-21T10:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: Using proc rank in a multiple group by</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-proc-rank-in-a-multiple-group-by/m-p/472121#M70978</link>
      <description>&lt;P&gt;That sounds like enumeration rather than ranking.&lt;/P&gt;
&lt;P&gt;Enumeration is when you count records to identify groups.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ranking is grouping data based on a variables value so that the top 10 are together for example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stats.idre.ucla.edu/sas/faq/how-can-i-create-an-enumeration-variable-by-groups/" target="_blank"&gt;https://stats.idre.ucla.edu/sas/faq/how-can-i-create-an-enumeration-variable-by-groups/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 14:50:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-proc-rank-in-a-multiple-group-by/m-p/472121#M70978</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-21T14:50:26Z</dc:date>
    </item>
  </channel>
</rss>

