My dataset shows a list of hospital departments and how many patients has been on the given departments for a specific period.
The first id duplicates show patients which moved to the department from other hospital departments, and the last id duplicate shows the sum of all the patients which has been on the department at that given period.
As I am only interested in the last id duplicate which shows the total sum of patients at the specific departments, I have been trying for a long way to figure out how to drop all id duplicates but the last, alas unsuccesfull.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str62 afdeling str26 Startbelægning str11 Nyindlagte str8 Tilflyttede str11 Sengedøgn "OUH Anæstesi-Intensiv Afs. Vita (Odense) (4202011)" "" "" "" "" "OUH Anæstesi-Intensiv Afs. Vita (Odense) (4202011)" "8,00" "" "115,00" "236,85" "OUH Anæstesi-Intensiv Afs. Vita (Odense) (4202011)" "3,00" "" "35,00" "108,96" "OUH Anæstesi-Intensiv Afs. Vita (Odense) (4202011)" "" "" "1,00" "0,08" "OUH Anæstesi-Intensiv Afs. Vita (Odense) (4202011)" "11,00" "" "151,00" "345,88" "OUH Barselsafsnit Vuggen (Odense) ()" "" "" "" "" "OUH Barselsafsnit Vuggen (Odense) ()" "" "" "" "" "OUH Brystkirurgisk Afs. (Odense) ()" "" "" "" "" "OUH Brystkirurgisk Afs. (Odense) ()" "" "39,00" "17,00" "9,94" "OUH Brystkirurgisk Afs. (Odense) ()" "" "39,00" "17,00" "9,94" "OUH Endokrinologisk Afs. MCS (Odense) ()" "" "" "" "" "OUH Endokrinologisk Afs. MCS (Odense) ()" "" "4,00" "" "8,99" "OUH Endokrinologisk Afs. MCS (Odense) ()" "10,00" "73,00" "13,00" "320,87" "OUH Endokrinologisk Afs. MCS (Odense) ()" "" "" "1,00" "0,00" "OUH Endokrinologisk Afs. MCS (Odense) ()" "" "" "1,00" "1,19" "OUH Endokrinologisk Afs. MCS (Odense) ()" "" "" "1,00" "5,07" "OUH Endokrinologisk Afs. MCS (Odense) ()" "10,00" "77,00" "16,00" "336,12" "OUH Endokrinologisk Afs. ME (Odense) ()" "" "" "" "" "OUH Endokrinologisk Afs. ME (Odense) ()" "5,00" "13,00" "7,00" "199,99" "OUH Endokrinologisk Afs. ME (Odense) ()" "5,00" "13,00" "7,00" "199,99" end
Any help would be appreciated.
Sincerely
0 Response to Remove all ID duplicates except the last.
Post a Comment