I have a question regarding proc sql sintax.
I need to find top 5 rows in a query which contains group by.
In particolar I need top 5 for each aggegation groups and not 5 rows at all.
In Oracle sintax I think I could use "Partition By" over a given rank in order to apply this wish.
Could you please suggest me a workaround to use in proc sql or a specific function if existing?
I really thank you a lot in advance for your support!
dm 'clear log; clear output';
Title 'Top 5' ;
proc sql ;
from have as a
left join have as b on (a.year=b.year and a.assets le b.assets)
group by a.year, a.assets
having count(*) le 5
order by a.year, a.assets desc ;