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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 890 views
  • 0 likes
  • 3 in conversation