Hi,
I would like to identify the three highest-paid waitresses in terms of "total compensation" in each hotel-year. I also would like to keep such three waitresses only with other receptionists. Note that, in some cases, the third and fourth highest-paid waitresses have the exact same compensation. In such a case, I would like to keep the one with the highest "base salary". if both have the exact base salary and total compensation, I would like to keep either one of them. Also, I would like to ignore observations with missing compensation data.

I am new to Stata and I would like the simplest way to do it. Thanks in advance.

Code:
ssc install dataex
clear
input int year str6 staff_id str5 hotel_id byte(waitress receptionist) str6 base_salary str6 total_compensation
2009 "124665" "23453" 1 0 40 112
2009 "455543" "23453" 0 1 60 111
2009 "334532" "23453" 1 0 55 222
2009 "888976" "23453" 1 0 80 90
2009 "903454" "23453" 1 0 88 90
2009 "457888" "23453" 1 0 . 90

2010 "124665" "23453" 1 0 53 90
2010 "455543" "23453" 0 1 45 88
2010 "334532" "23453" 1 0 33 79
2010 "556333" "23453" 1 0 60 60
2010 "299211" "23453" 1 0 60 60
2010 "235987" "23453" 1 0 60 .

2011 "124665" "23453" 1 0 40 67
2011 "877776" "23453" 0 1 34 89
2011 "666755" "23453" 1 0 12 99
2011 "556333" "23453" 1 0 50 66
2011 "563222" "23453" 1 0 50 66
2011 "967656" "23453" 1 0 50 66
2011 "343434" "23453" 1 0 13 .
end