tag:blogger.com,1999:blog-7958828565254404797.post4400818025385353055..comments2024-03-29T00:02:14.892-07:00Comments on ListenData: 4 ways to find maximum value in a group with SASDeepanshu Bhallahttp://www.blogger.com/profile/09802839558125192674noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-7958828565254404797.post-13392656972655734092018-04-16T11:14:02.022-07:002018-04-16T11:14:02.022-07:00proc sort data= test;
by id descending sale;
run;
...proc sort data= test;<br />by id descending sale;<br />run;<br /><br />data test1;<br />set test;<br />by id;<br />if first.id=1 then count=1;<br />else count+1;<br />if count=2 then output test1;<br />run;<br /><br />I hope this will work.Anubhav Mehtahttps://www.blogger.com/profile/06090966409114820490noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-85652757305700748842018-04-16T11:11:43.296-07:002018-04-16T11:11:43.296-07:00This comment has been removed by the author.Anubhav Mehtahttps://www.blogger.com/profile/06090966409114820490noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-10759312439507473372017-07-16T10:59:21.273-07:002017-07-16T10:59:21.273-07:00Why are we applying self join here when a simple q...Why are we applying self join here when a simple query can give the same results?<br /><br />proc sql;<br />select id, product, max(sale) as max_sale from test<br />group by ID;<br />quit;Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-4030740016501845802017-04-15T07:49:23.247-07:002017-04-15T07:49:23.247-07:00How to find out second maximum using proc sort onl...How to find out second maximum using proc sort only... Plz tell..Thank u..Anonymoushttps://www.blogger.com/profile/16064530061346762258noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-57285774586663290602016-05-22T00:45:54.952-07:002016-05-22T00:45:54.952-07:00It's the same table 'test'. We are app...It's the same table 'test'. We are applying self join here i.e. a table is joined to itself.Deepanshu Bhallahttps://www.blogger.com/profile/09802839558125192674noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-56729119749605887452016-05-21T22:41:37.830-07:002016-05-21T22:41:37.830-07:00In the last method by using proc sql,want to know ...In the last method by using proc sql,want to know which is the table b on which we are applying an inner joinBHANU BANSALhttps://www.blogger.com/profile/04028304470551248577noreply@blogger.com