I am trying to find the highest, second highest, and third highest value per year and group. But if there are ties then the first/second highest could be the same, ect. like the example below:
have:
Year Group ID Value
2000 A 001 103
2000 A 002 108
2000 A 003 108
2000 A 004 94
2000 B 005 87
2000 B 006 87
2000 C 009 89
2001 A 001 201
2001 B 005 302
2001 B 006 211
2001 B 007 211
2001 B 008 198
2001 C 009 277
2001 C 0010 246
want:
YEAR GROUP TOP_VALUE NUM2_VALUE NUM3_VALUE
2000 A 108 108 103
2000 B 87 87 NA
2000 C 89 NA NA
2001 A 201 NA NA
2001 B 302 211 211
2001 C 277 246 NA
I can’t find a solution that handles ties this way. Thanks in advance for any help!