<?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: Rank using multiple by variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Rank-using-multiple-by-variables/m-p/475075#M122147</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data RankQuestion;
   input Var1  Var2  TestVal ;
   datalines;
	1 1 0.42
	1 2 0.62
	1 3 0.22
	5 4 0.12
	5 6 0.11
	5 9 0.13
	8 7 0.99
	8 10 0.84
	8 11 0.85
	;
	
proc sort data = RankQuestion out = RawSort; 
	by Var1  testval; 
run; 
proc rank data = RawSort out = RankRes   ties=low; ;
	by Var1 ; 
	var   TestVal ; 
	ranks newrank1 ; 
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 03 Jul 2018 00:16:02 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-07-03T00:16:02Z</dc:date>
    <item>
      <title>Rank using multiple by variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rank-using-multiple-by-variables/m-p/475063#M122144</link>
      <description>&lt;P&gt;All,&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;I am looking for some help in trying to rank a data set using multiple by-variables. I am attaching a sample script that I tried to put together, however, I am not sure where I am going wrong. I am trying to follow the example provided here (&lt;A href="http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#p12aek9f6xhl1zn1puuuot19wqi7.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#p12aek9f6xhl1zn1puuuot19wqi7.htm&lt;/A&gt;) . Obviously, I am doing something wrong, however I am not familiar with Proc Rank or Proc Sort well enough to understand what I am doing wrong.&amp;nbsp; If Var1 is my first grouping variable, Var2 is my second grouping variable and TestVal is the value I want to compute ranks of my dataset, can some body please guide me and explain what I am doing wrong.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data RankQuestion;
   input Var1 1-2 Var2 3-4 TestVal 5-9;
   datalines;
	1 1 0.42
	1 2 0.62
	1 3 0.22
	5 4 0.12
	5 6 0.11
	5 9 0.13
	8 7 0.99
	8 10 0.84
	8 11 0.85
	;
	
proc sort data = RankQuestion out = RawSort; 
	by Var1 Var2 TestVal; 
run; 

proc rank data = RawSort out = RankRes ties = low descending;
	by Var1 Var2; 
	var TestVal; 
	ranks newrank; 
run;

proc print data =  RankRes ; 
	by Var1 Var2 newrank; 
	title 'Testing Rank By Groups';
run; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 22:25:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rank-using-multiple-by-variables/m-p/475063#M122144</guid>
      <dc:creator>UdayGuntupalli</dc:creator>
      <dc:date>2018-07-02T22:25:41Z</dc:date>
    </item>
    <item>
      <title>Re: Rank using multiple by variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rank-using-multiple-by-variables/m-p/475069#M122145</link>
      <description>&lt;P&gt;You'll have to show what you want the result to be.&amp;nbsp; It's too much of a leap of faith to show us code that doesn't work right, and hope we can figure out what "work right" means.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 23:06:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rank-using-multiple-by-variables/m-p/475069#M122145</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-07-02T23:06:20Z</dc:date>
    </item>
    <item>
      <title>Re: Rank using multiple by variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rank-using-multiple-by-variables/m-p/475071#M122146</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Var1 Var2 TestVal Rank&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; 3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.22&amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.42&amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.62&amp;nbsp; &amp;nbsp; &amp;nbsp;3&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5&amp;nbsp; &amp;nbsp; &amp;nbsp; 6&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.11&amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5&amp;nbsp; &amp;nbsp; &amp;nbsp; 4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.12&amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5&amp;nbsp; &amp;nbsp; &amp;nbsp; 9&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.13&amp;nbsp; &amp;nbsp; &amp;nbsp;3&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Here is an example of the desired output.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 23:50:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rank-using-multiple-by-variables/m-p/475071#M122146</guid>
      <dc:creator>UdayGuntupalli</dc:creator>
      <dc:date>2018-07-02T23:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: Rank using multiple by variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rank-using-multiple-by-variables/m-p/475075#M122147</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data RankQuestion;
   input Var1  Var2  TestVal ;
   datalines;
	1 1 0.42
	1 2 0.62
	1 3 0.22
	5 4 0.12
	5 6 0.11
	5 9 0.13
	8 7 0.99
	8 10 0.84
	8 11 0.85
	;
	
proc sort data = RankQuestion out = RawSort; 
	by Var1  testval; 
run; 
proc rank data = RawSort out = RankRes   ties=low; ;
	by Var1 ; 
	var   TestVal ; 
	ranks newrank1 ; 
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Jul 2018 00:16:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rank-using-multiple-by-variables/m-p/475075#M122147</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-07-03T00:16:02Z</dc:date>
    </item>
    <item>
      <title>Re: Rank using multiple by variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rank-using-multiple-by-variables/m-p/475077#M122148</link>
      <description>&lt;P&gt;You seem to want to order by TestVal within Var1 groups. What should be the role of Var2?&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jul 2018 00:17:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rank-using-multiple-by-variables/m-p/475077#M122148</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-07-03T00:17:35Z</dc:date>
    </item>
  </channel>
</rss>

