<?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: base sas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385469#M92212</link>
    <description>&lt;P&gt;Using "base sas" as the subject of a question in the&amp;nbsp;&lt;EM&gt;Base SAS&lt;/EM&gt; forum is not very bright. Please be more descriptive on your next question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use proc rank for ranking, BTW.&lt;/P&gt;</description>
    <pubDate>Thu, 03 Aug 2017 19:38:28 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-08-03T19:38:28Z</dc:date>
    <item>
      <title>base sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385459#M92203</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I want to rank the below id according to marks using only data step first dot last dot , Kindly help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data ma;&lt;BR /&gt;input id$ marks;&lt;BR /&gt;cards;&lt;BR /&gt;a 20&lt;BR /&gt;b 33&lt;BR /&gt;c 13&lt;BR /&gt;d 44&lt;BR /&gt;e 13&lt;BR /&gt;f 33&lt;BR /&gt;;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 19:25:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385459#M92203</guid>
      <dc:creator>shivamarrora0</dc:creator>
      <dc:date>2017-08-03T19:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: base sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385462#M92205</link>
      <description>&lt;P&gt;When you say rank, do you mean sort? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 19:30:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385462#M92205</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-08-03T19:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: base sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385463#M92206</link>
      <description>&lt;P&gt;And what would the output look like?&lt;/P&gt;
&lt;P&gt;Ranking often involves adding a variable that indicates the "rank" a specific record belongs to. But there should be some idea for how those ranks are assigned and what the number of ranks would be. Do you want to rank on a 1 to 5 scale, a 1 to 10 scale, a 1 to 100 or something else?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 19:32:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385463#M92206</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-08-03T19:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: base sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385465#M92208</link>
      <description>&lt;P&gt;Where are the groups to use by variables in your sample. Your id values are all unique. The marks has ties. The point of using first and last variables would not make sense your requirement. To use first and last, you need repeats on by values. For example,&lt;/P&gt;&lt;P&gt;1. a transaction dataset&lt;/P&gt;&lt;P&gt;2. Patients multiple visits to hospitals&lt;/P&gt;&lt;P&gt;3. Repeat customers in a store like a loyatly program&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you understand the business, the code will come to your mind automatically. Anyways, let us the know the correct req, you will get a neat solution. Also, you should let us know how to handle ties in ranks, i.e b and f in your example, both having scored 33&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 19:36:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385465#M92208</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-08-03T19:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: base sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385469#M92212</link>
      <description>&lt;P&gt;Using "base sas" as the subject of a question in the&amp;nbsp;&lt;EM&gt;Base SAS&lt;/EM&gt; forum is not very bright. Please be more descriptive on your next question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use proc rank for ranking, BTW.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 19:38:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385469#M92212</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-03T19:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: base sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385480#M92218</link>
      <description>&lt;P&gt;The out put i want to sort the marks in order then rank them ;&lt;/P&gt;&lt;P&gt;if the marks are same then the rank should tie &amp;nbsp;and if the null value then it skip that rank&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;marks rank&lt;/P&gt;&lt;P&gt;30 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;22 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;22 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;20 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Like this&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 20:27:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385480#M92218</guid>
      <dc:creator>shivamarrora0</dc:creator>
      <dc:date>2017-08-03T20:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: base sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385483#M92219</link>
      <description>&lt;P&gt;all that can be done in PROC RANK&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No need to sort the data before running PROC RANK (unless you need it sorted for some other reason)&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 20:29:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385483#M92219</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-08-03T20:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: base sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385510#M92230</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/144247"&gt;@shivamarrora0&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;The out put i want to sort the marks in order then rank them ;&lt;/P&gt;
&lt;P&gt;if the marks are same then the rank should tie &amp;nbsp;and if the null value then it skip that rank&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;marks rank&lt;/P&gt;
&lt;P&gt;30 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;
&lt;P&gt;22 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;
&lt;P&gt;22 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;
&lt;P&gt;20 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Like this&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Since the data step doesn't make it easy to "look ahead" in the data your requirement for ties would add a lot of complexity to data step logic. WHY is the requirement not to use Proc Rank which is designed to do this?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 22:11:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385510#M92230</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-08-03T22:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: base sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385572#M92252</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/144247"&gt;@shivamarrora0&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;The out put i want to sort the marks in order then rank them ;&lt;/P&gt;
&lt;P&gt;if the marks are same then the rank should tie &amp;nbsp;and if the null value then it skip that rank&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;marks rank&lt;/P&gt;
&lt;P&gt;30 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;
&lt;P&gt;22 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;
&lt;P&gt;22 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;
&lt;P&gt;20 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Like this&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Since the data step doesn't make it easy to "look ahead" in the data your requirement for ties would add a lot of complexity to data step logic. WHY is the requirement not to use Proc Rank which is designed to do this?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I guess that, because proc rank would give this result:&lt;/P&gt;
&lt;PRE&gt;marks rank
30    1
22    2
22    2
20    4&lt;/PRE&gt;
&lt;P&gt;To count equal values into just one rank, I would&lt;/P&gt;
&lt;P&gt;- sort the dataset by descending marks&lt;/P&gt;
&lt;P&gt;- in a data step with by descending marks, retain rank (starting with 0) and increment it at every first.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2017 06:24:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385572#M92252</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-04T06:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: base sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385591#M92259</link>
      <description>I think the below code will work&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;proc sort data=test;&lt;BR /&gt;by descending marks;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data rank;&lt;BR /&gt;set test;&lt;BR /&gt;by descending marks;&lt;BR /&gt;if first.marks then count+1;&lt;BR /&gt;run;&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Aug 2017 08:04:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385591#M92259</guid>
      <dc:creator>shivamarrora0</dc:creator>
      <dc:date>2017-08-04T08:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: base sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385592#M92260</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/144247"&gt;@shivamarrora0&lt;/a&gt; wrote:&lt;BR /&gt;I think the below code will work&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;proc sort data=test;&lt;BR /&gt;by descending marks;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data rank;&lt;BR /&gt;set test;&lt;BR /&gt;by descending marks;&lt;BR /&gt;if first.marks then count+1;&lt;BR /&gt;run;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Exactly the solution I was pointing you at!&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2017 08:07:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385592#M92260</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-04T08:07:02Z</dc:date>
    </item>
    <item>
      <title>Re: base sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385614#M92266</link>
      <description>Thank you Kurt..&lt;BR /&gt;&lt;BR /&gt;i was just confuse .. t</description>
      <pubDate>Fri, 04 Aug 2017 09:35:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385614#M92266</guid>
      <dc:creator>shivamarrora0</dc:creator>
      <dc:date>2017-08-04T09:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: base sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385624#M92270</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/144247"&gt;@shivamarrora0&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;The out put i want to sort the marks in order then rank them ;&lt;/P&gt;
&lt;P&gt;if the marks are same then the rank should tie &amp;nbsp;and if the null value then it skip that rank&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;marks rank&lt;/P&gt;
&lt;P&gt;30 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;
&lt;P&gt;22 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;
&lt;P&gt;22 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;
&lt;P&gt;20 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Like this&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Since the data step doesn't make it easy to "look ahead" in the data your requirement for ties would add a lot of complexity to data step logic. WHY is the requirement not to use Proc Rank which is designed to do this?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I guess that, because proc rank would give this result:&lt;/P&gt;
&lt;PRE&gt;marks rank
30    1
22    2
22    2
20    4&lt;/PRE&gt;
&lt;P&gt;To count equal values into just one rank, I would&lt;/P&gt;
&lt;P&gt;- sort the dataset by descending marks&lt;/P&gt;
&lt;P&gt;- in a data step with by descending marks, retain rank (starting with 0) and increment it at every first.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;PROC RANK will give average ranks to ties if you want, and you can easily reverse the rankings if they're in the wrong order.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2017 10:55:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385624#M92270</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-08-04T10:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: base sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385738#M92318</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/144247"&gt;@shivamarrora0&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;The out put i want to sort the marks in order then rank them ;&lt;/P&gt;
&lt;P&gt;if the marks are same then the rank should tie &amp;nbsp;and if the null value then it skip that rank&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;marks rank&lt;/P&gt;
&lt;P&gt;30 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;
&lt;P&gt;22 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;
&lt;P&gt;22 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;
&lt;P&gt;20 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Like this&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Since the data step doesn't make it easy to "look ahead" in the data your requirement for ties would add a lot of complexity to data step logic. WHY is the requirement not to use Proc Rank which is designed to do this?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I guess that, because proc rank would give this result:&lt;/P&gt;
&lt;PRE&gt;marks rank
30    1
22    2
22    2
20    4&lt;/PRE&gt;
&lt;P&gt;To count equal values into just one rank, I would&lt;/P&gt;
&lt;P&gt;- sort the dataset by descending marks&lt;/P&gt;
&lt;P&gt;- in a data step with by descending marks, retain rank (starting with 0) and increment it at every first.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Or use the TIES= option for either Low or high&lt;/P&gt;
&lt;PRE&gt;data junk;
   input marks;
datalines;
22
30
22
20
;
run;

proc rank data=junk descending ties=low out=ranked;
   var marks;
   ranks rank;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Aug 2017 17:57:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/base-sas/m-p/385738#M92318</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-08-04T17:57:45Z</dc:date>
    </item>
  </channel>
</rss>

