<?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: Assign status in the group in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Assign-status-in-the-group/m-p/215150#M39701</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does it have to be the word first, second, third or can it be 1st, 2nd, 3rd?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What version of SAS do you have and Also what have you tried?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 May 2015 19:11:43 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2015-05-14T19:11:43Z</dc:date>
    <item>
      <title>Assign status in the group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-status-in-the-group/m-p/215149#M39700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have this dataset. Maximum count could be assigned One second max would be second like on........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code should be dynamic in the way that accepts any condition.like 2 depts only 10 depts....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input ID Dept Count ;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;101 1 10&lt;/P&gt;&lt;P&gt;101 2 50&lt;/P&gt;&lt;P&gt;101 3 25&lt;/P&gt;&lt;P&gt;102 1 30&lt;/P&gt;&lt;P&gt;102 2 25&lt;/P&gt;&lt;P&gt;102 3 35&lt;/P&gt;&lt;P&gt;103 1 40&lt;/P&gt;&lt;P&gt;103 2 25&lt;/P&gt;&lt;P&gt;103 3 10&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="256"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="20" width="64"&gt;ID&lt;/TD&gt;&lt;TD width="64"&gt;Dept&lt;/TD&gt;&lt;TD width="64"&gt;Count&lt;/TD&gt;&lt;TD width="64"&gt;Status&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;101&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;10&lt;/TD&gt;&lt;TD&gt;third&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;101&lt;/TD&gt;&lt;TD align="right"&gt;2&lt;/TD&gt;&lt;TD align="right"&gt;50&lt;/TD&gt;&lt;TD&gt;first&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;101&lt;/TD&gt;&lt;TD align="right"&gt;3&lt;/TD&gt;&lt;TD align="right"&gt;25&lt;/TD&gt;&lt;TD&gt;second&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;102&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;30&lt;/TD&gt;&lt;TD&gt;second&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;102&lt;/TD&gt;&lt;TD align="right"&gt;2&lt;/TD&gt;&lt;TD align="right"&gt;25&lt;/TD&gt;&lt;TD&gt;third&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;102&lt;/TD&gt;&lt;TD align="right"&gt;3&lt;/TD&gt;&lt;TD align="right"&gt;35&lt;/TD&gt;&lt;TD&gt;first&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;103&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;40&lt;/TD&gt;&lt;TD&gt;first&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;103&lt;/TD&gt;&lt;TD align="right"&gt;2&lt;/TD&gt;&lt;TD align="right"&gt;25&lt;/TD&gt;&lt;TD&gt;second&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;103&lt;/TD&gt;&lt;TD align="right"&gt;3&lt;/TD&gt;&lt;TD align="right"&gt;10&lt;/TD&gt;&lt;TD&gt;third&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 18:55:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-status-in-the-group/m-p/215149#M39700</guid>
      <dc:creator>kumarK</dc:creator>
      <dc:date>2015-05-14T18:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: Assign status in the group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-status-in-the-group/m-p/215150#M39701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does it have to be the word first, second, third or can it be 1st, 2nd, 3rd?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What version of SAS do you have and Also what have you tried?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 19:11:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-status-in-the-group/m-p/215150#M39701</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-05-14T19:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: Assign status in the group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-status-in-the-group/m-p/215151#M39702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Anything 1st ,2nd or 3rd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have 9.2&amp;nbsp; and tried this way but it is not giving second and third.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table want as&lt;/P&gt;&lt;P&gt;select id,max(count)as max from have&lt;/P&gt;&lt;P&gt;group by 1;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 19:15:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-status-in-the-group/m-p/215151#M39702</guid>
      <dc:creator>kumarK</dc:creator>
      <dc:date>2015-05-14T19:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: Assign status in the group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-status-in-the-group/m-p/215152#M39703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;word such as first, second ect should be avoided in the the data itself, in the case of the reporting, use format. So in this case, PROC RANK comes in handy:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; ID Dept Count;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;101 1 10&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;101 2 50&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;101 3 25&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;102 1 30&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;102 2 25&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;102 3 35&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;103 1 40&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;103 2 25&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;103 3 10&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;rank&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=have &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=want &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;ties&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=low &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;descending&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; id;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;var&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; count;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;ranks&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; CountRank;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 19:16:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-status-in-the-group/m-p/215152#M39703</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-05-14T19:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: Assign status in the group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-status-in-the-group/m-p/215153#M39704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there any alternative way without using procedures in data step or SQL, i have to include some other conditions also.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 19:25:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-status-in-the-group/m-p/215153#M39704</guid>
      <dc:creator>kumarK</dc:creator>
      <dc:date>2015-05-14T19:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: Assign status in the group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-status-in-the-group/m-p/215154#M39705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need a custom format.&lt;/P&gt;&lt;P&gt;First create the ranks using either a data step or proc rank and then apply the format. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="active_link" href="https://gist.github.com/statgeek/6c885f6aea18dbd6caf8" title="https://gist.github.com/statgeek/6c885f6aea18dbd6caf8"&gt;Create a format for ordinal numbers (1-1st, 2-2nd)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input ID Dept Count;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;101 1 10&lt;/P&gt;&lt;P&gt;101 2 50&lt;/P&gt;&lt;P&gt;101 3 25&lt;/P&gt;&lt;P&gt;102 1 30&lt;/P&gt;&lt;P&gt;102 2 25&lt;/P&gt;&lt;P&gt;102 3 35&lt;/P&gt;&lt;P&gt;103 1 40&lt;/P&gt;&lt;P&gt;103 2 25&lt;/P&gt;&lt;P&gt;103 3 10&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=have; by id descending count;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;by id descending count;&lt;/P&gt;&lt;P&gt;if first.id then rank=1;&lt;/P&gt;&lt;P&gt;else rank+1;&lt;/P&gt;&lt;P&gt;format rank ordinal_fmt.;&lt;/P&gt;&lt;P&gt;rank_desc=put(rank, ordinal_fmt.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 19:28:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-status-in-the-group/m-p/215154#M39705</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-05-14T19:28:22Z</dc:date>
    </item>
    <item>
      <title>Re: Assign status in the group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-status-in-the-group/m-p/215155#M39706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@kumarK If you're going to remove questions as well, I don't feel like its worth taking the time to answer them. Make the questions generic enough to not violate company policy. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 19:30:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-status-in-the-group/m-p/215155#M39706</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-05-14T19:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: Assign status in the group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-status-in-the-group/m-p/215156#M39707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Generally the approach would be to assign categories based on your values and then create any ranking or analysis by the group variable(s).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 19:31:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-status-in-the-group/m-p/215156#M39707</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-05-14T19:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: Assign status in the group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-status-in-the-group/m-p/215157#M39708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;also don't forget format WORDS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;by id descending count;&lt;/P&gt;&lt;P&gt;if first.id then rank=1;&lt;/P&gt;&lt;P&gt;else rank+1;&lt;/P&gt;&lt;P&gt;format rank words.;&lt;/P&gt;&lt;P&gt;rank_desc=put(rank, words.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 May 2015 14:33:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-status-in-the-group/m-p/215157#M39708</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-05-15T14:33:47Z</dc:date>
    </item>
  </channel>
</rss>

