<?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: top N th highest sal in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/top-N-th-highest-sal/m-p/630333#M77685</link>
    <description>&lt;P&gt;I want proc sql query not proc rank and hash table&lt;/P&gt;</description>
    <pubDate>Sat, 07 Mar 2020 09:41:13 GMT</pubDate>
    <dc:creator>BrahmanandaRao</dc:creator>
    <dc:date>2020-03-07T09:41:13Z</dc:date>
    <item>
      <title>top N th highest sal</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/top-N-th-highest-sal/m-p/630330#M77682</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;using Proc sql&amp;nbsp; how to find top Nth Highest salaries for each department wise even if same salary respective departments&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Mar 2020 08:31:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/top-N-th-highest-sal/m-p/630330#M77682</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2020-03-07T08:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: top N th highest sal</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/top-N-th-highest-sal/m-p/630331#M77683</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC RANK would be a great tool to achieve this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input dpt $ employeeID salary;
	datalines;
A 1 100
A 2 110
A 3 90
B 1 120
B 2 70
B 3 60
B 4 130
;
run;

proc rank data=have out=want (where=(top_salary&amp;lt;=2)) descending; /* instead of "2", put the top "n" that you want*/
	by dpt;
	var salary;
	ranks top_salary;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 07 Mar 2020 09:36:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/top-N-th-highest-sal/m-p/630331#M77683</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-03-07T09:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: top N th highest sal</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/top-N-th-highest-sal/m-p/630332#M77684</link>
      <description>&lt;P&gt;As an alternative, and especially if you have a huge dataset, a HASH can be useful:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input dpt $ employeeID salary;
	datalines;
A 1 100
A 2 110
A 3 90
B 1 120
B 2 70
B 3 60
B 4 130
;
run;

data want;
	declare hash h(multidata: 'y', ordered: 'd');
	h.definekey('salary');
	h.definedata('dpt', 'employeeID', 'salary');
	h.definedone();
	declare hiter C('h');

	do until(last.dpt);
		set have;
		by dpt;
		h.add();
	end;
	
	C.first();
	do i=1 to 2; /*instead of 2, put the top'n' that you want*/
		output;
		C.next();
	end;
	
	drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 07 Mar 2020 09:37:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/top-N-th-highest-sal/m-p/630332#M77684</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-03-07T09:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: top N th highest sal</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/top-N-th-highest-sal/m-p/630333#M77685</link>
      <description>&lt;P&gt;I want proc sql query not proc rank and hash table&lt;/P&gt;</description>
      <pubDate>Sat, 07 Mar 2020 09:41:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/top-N-th-highest-sal/m-p/630333#M77685</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2020-03-07T09:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: top N th highest sal</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/top-N-th-highest-sal/m-p/630334#M77686</link>
      <description>&lt;P&gt;&lt;EM&gt;"Saying thank you is more than good manners. it is good spirituality"&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Mar 2020 09:59:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/top-N-th-highest-sal/m-p/630334#M77686</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-03-07T09:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: top N th highest sal</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/top-N-th-highest-sal/m-p/630335#M77687</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I want proc sql query not proc rank and hash table&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Don't be stupid, use the right tool.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Mar 2020 10:07:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/top-N-th-highest-sal/m-p/630335#M77687</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-03-07T10:07:05Z</dc:date>
    </item>
  </channel>
</rss>

