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

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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