BookmarkSubscribeRSS Feed
vandhan
Fluorite | Level 6

data have;
input id sal;
cards;
101 1000
102 2000
103 1000
104 3000
105 3000
106 4000
;

How would i find 3rd max sal from above data using sql ??

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

It is simpler to use a datastep here:

data have;
  input id sal;
cards;
101 1000
102 2000
103 1000
104 3000
105 3000
106 4000
;
run;

proc sort data=have;
  by sal;
run;

data want;
  set have;
  if _n_=3;
run;
vandhan
Fluorite | Level 6
if i have max values 6 values like 4000 ... in that case this is not
possible...

##- Please type your reply above this line. Simple formatting, no
attachments. -##
LinusH
Tourmaline | Level 20

Hey, stop posting the same question in different forums, pls.

Data never sleeps

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1090 views
  • 0 likes
  • 3 in conversation