<?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: proc sql: Does something similar to &amp;quot;Partition by&amp;quot; exist? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-Does-something-similar-to-quot-Partition-by-quot-exist/m-p/75454#M16250</link>
    <description>Hi Daniele&lt;BR /&gt;
&lt;BR /&gt;
As found under &lt;A href="http://groups.google.com/group/comp.soft-sys.sas/msg/3daf525de6e48d59" target="_blank"&gt;http://groups.google.com/group/comp.soft-sys.sas/msg/3daf525de6e48d59&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
HTH &lt;BR /&gt;
Patrick&lt;BR /&gt;
&lt;BR /&gt;
data have;&lt;BR /&gt;
input YEAR ASSETS;&lt;BR /&gt;
datalines; &lt;BR /&gt;
1998   10 &lt;BR /&gt;
1998   20 &lt;BR /&gt;
1998   30 &lt;BR /&gt;
1998   40 &lt;BR /&gt;
1998   50 &lt;BR /&gt;
1998   60 &lt;BR /&gt;
1998   70 &lt;BR /&gt;
1998   80 &lt;BR /&gt;
1997  500 &lt;BR /&gt;
1997  600 &lt;BR /&gt;
1997  700 &lt;BR /&gt;
1997  800 &lt;BR /&gt;
1997  100 &lt;BR /&gt;
1997  200 &lt;BR /&gt;
1997  300 &lt;BR /&gt;
1997  400 &lt;BR /&gt;
;&lt;BR /&gt;
&lt;BR /&gt;
dm 'clear log; clear output'; &lt;BR /&gt;
Title 'Top 5' ; &lt;BR /&gt;
proc sql ; &lt;BR /&gt;
     select a.* &lt;BR /&gt;
     from have as a &lt;BR /&gt;
     left join have as b on (a.year=b.year and a.assets le b.assets) &lt;BR /&gt;
     group by a.year, a.assets &lt;BR /&gt;
     having count(*) le 5 &lt;BR /&gt;
     order by a.year, a.assets desc ; &lt;BR /&gt;
quit;</description>
    <pubDate>Mon, 12 Oct 2009 04:04:17 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2009-10-12T04:04:17Z</dc:date>
    <item>
      <title>proc sql: Does something similar to "Partition by" exist?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-Does-something-similar-to-quot-Partition-by-quot-exist/m-p/75453#M16249</link>
      <description>Hi all,&lt;BR /&gt;
I have a question regarding proc sql sintax.&lt;BR /&gt;
I need to find top 5 rows in a query which contains group by.&lt;BR /&gt;
In particolar I need top 5 for each aggegation groups and not 5 rows at all.&lt;BR /&gt;
In Oracle sintax I think I could use "Partition By" over a given rank in order to apply this wish.&lt;BR /&gt;
Could you please suggest me a workaround to use in proc sql or a specific function if existing?&lt;BR /&gt;
&lt;BR /&gt;
I really thank you a lot in advance for your support!&lt;BR /&gt;
&lt;BR /&gt;
KR&lt;BR /&gt;
&lt;BR /&gt;
Daniele.</description>
      <pubDate>Sun, 11 Oct 2009 11:31:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-Does-something-similar-to-quot-Partition-by-quot-exist/m-p/75453#M16249</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-10-11T11:31:16Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql: Does something similar to "Partition by" exist?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-Does-something-similar-to-quot-Partition-by-quot-exist/m-p/75454#M16250</link>
      <description>Hi Daniele&lt;BR /&gt;
&lt;BR /&gt;
As found under &lt;A href="http://groups.google.com/group/comp.soft-sys.sas/msg/3daf525de6e48d59" target="_blank"&gt;http://groups.google.com/group/comp.soft-sys.sas/msg/3daf525de6e48d59&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
HTH &lt;BR /&gt;
Patrick&lt;BR /&gt;
&lt;BR /&gt;
data have;&lt;BR /&gt;
input YEAR ASSETS;&lt;BR /&gt;
datalines; &lt;BR /&gt;
1998   10 &lt;BR /&gt;
1998   20 &lt;BR /&gt;
1998   30 &lt;BR /&gt;
1998   40 &lt;BR /&gt;
1998   50 &lt;BR /&gt;
1998   60 &lt;BR /&gt;
1998   70 &lt;BR /&gt;
1998   80 &lt;BR /&gt;
1997  500 &lt;BR /&gt;
1997  600 &lt;BR /&gt;
1997  700 &lt;BR /&gt;
1997  800 &lt;BR /&gt;
1997  100 &lt;BR /&gt;
1997  200 &lt;BR /&gt;
1997  300 &lt;BR /&gt;
1997  400 &lt;BR /&gt;
;&lt;BR /&gt;
&lt;BR /&gt;
dm 'clear log; clear output'; &lt;BR /&gt;
Title 'Top 5' ; &lt;BR /&gt;
proc sql ; &lt;BR /&gt;
     select a.* &lt;BR /&gt;
     from have as a &lt;BR /&gt;
     left join have as b on (a.year=b.year and a.assets le b.assets) &lt;BR /&gt;
     group by a.year, a.assets &lt;BR /&gt;
     having count(*) le 5 &lt;BR /&gt;
     order by a.year, a.assets desc ; &lt;BR /&gt;
quit;</description>
      <pubDate>Mon, 12 Oct 2009 04:04:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-Does-something-similar-to-quot-Partition-by-quot-exist/m-p/75454#M16250</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2009-10-12T04:04:17Z</dc:date>
    </item>
  </channel>
</rss>

