<?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: Help in Rank function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-in-Rank-function/m-p/379527#M91364</link>
    <description>&lt;P&gt;What is your rule for ranking a character variable?&lt;/P&gt;
&lt;P&gt;Since you have US within 3 of the ID groups it isn't clear what that rule may be.&lt;/P&gt;
&lt;P&gt;Also you might want to work the result for all of your example data and not remove the Region variable.&lt;/P&gt;</description>
    <pubDate>Wed, 26 Jul 2017 19:38:39 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-07-26T19:38:39Z</dc:date>
    <item>
      <title>Help in Rank function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-in-Rank-function/m-p/379524#M91363</link>
      <description>&lt;P&gt;Please help! I want to Rank the second variable in this code.&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;input id region;&lt;BR /&gt;datalines;&lt;BR /&gt;10 US&lt;BR /&gt;10 CA&lt;BR /&gt;10 CA&lt;BR /&gt;23 MA&lt;BR /&gt;25 MA&lt;BR /&gt;45 Ks&lt;BR /&gt;50 US&lt;BR /&gt;50 SA&lt;BR /&gt;65 US&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;proc sort data = have;&lt;BR /&gt;by id;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;by id;&lt;BR /&gt;if first.id then rank =1;&lt;BR /&gt;else rank+1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output needed:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID &amp;nbsp;Rank1 Rank2&lt;/P&gt;&lt;P&gt;10 &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;10 &amp;nbsp; 2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;10 &amp;nbsp; 3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2017 19:34:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-in-Rank-function/m-p/379524#M91363</guid>
      <dc:creator>Kalai2008</dc:creator>
      <dc:date>2017-07-26T19:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Rank function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-in-Rank-function/m-p/379527#M91364</link>
      <description>&lt;P&gt;What is your rule for ranking a character variable?&lt;/P&gt;
&lt;P&gt;Since you have US within 3 of the ID groups it isn't clear what that rule may be.&lt;/P&gt;
&lt;P&gt;Also you might want to work the result for all of your example data and not remove the Region variable.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2017 19:38:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-in-Rank-function/m-p/379527#M91364</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-07-26T19:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Rank function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-in-Rank-function/m-p/379529#M91365</link>
      <description>&lt;P&gt;Thank you, My rule is to Rank a new column when the variable is US, Another Column to Rank, for CA separately and one column with no rules.(which I already got it from the prev query)&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2017 19:46:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-in-Rank-function/m-p/379529#M91365</guid>
      <dc:creator>Kalai2008</dc:creator>
      <dc:date>2017-07-26T19:46:19Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Rank function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-in-Rank-function/m-p/379535#M91366</link>
      <description>&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;Instructions above for the various situations you're working with.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2017 19:55:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-in-Rank-function/m-p/379535#M91366</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-26T19:55:39Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Rank function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-in-Rank-function/m-p/379567#M91369</link>
      <description>&lt;P&gt;Thank you Reeza!.. Great article! It helps!&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2017 21:05:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-in-Rank-function/m-p/379567#M91369</guid>
      <dc:creator>Kalai2008</dc:creator>
      <dc:date>2017-07-26T21:05:34Z</dc:date>
    </item>
  </channel>
</rss>

