Hello,
I have an encounter-level dataset that has participant IDs (pid), visit dates (appt_date) and one or more ICD-10 codes (current_icd10_list). , Unfortunately, some of the visits are counted as multiple encounters with a different ICD-10 code for each encounter (see pid=6 in my dataex example), rather than appropriately as one encounter with a list of ICD-10 codes (as in pid=40 in my dataex example). Can you help me figure out how to combine encounters that occur for the same pid on the same date into one encounter?
Thank you,
Sarah
I have an encounter-level dataset that has participant IDs (pid), visit dates (appt_date) and one or more ICD-10 codes (current_icd10_list). , Unfortunately, some of the visits are counted as multiple encounters with a different ICD-10 code for each encounter (see pid=6 in my dataex example), rather than appropriately as one encounter with a list of ICD-10 codes (as in pid=40 in my dataex example). Can you help me figure out how to combine encounters that occur for the same pid on the same date into one encounter?
Thank you,
Sarah
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float pid str30 current_icd10_list str8 appt_date 1 "NA" "10/21/19" 2 "NA" "9/4/19" 3 "E03.9" "9/3/19" 4 "NA" "9/3/19" 5 "M81.0" "9/17/19" 6 "E03.9" "9/12/19" 6 "M81.0" "9/12/19" 6 "E55.9" "9/12/19" 6 "E29.1" "9/12/19" 7 "Z86.39" "9/12/19" 8 "NA" "9/6/19" 9 "NA" "9/9/19" 10 "E29.1" "9/5/19" 11 "E05.00" "9/3/19" 12 "M81.0" "9/3/19" 13 "E03.9" "9/5/19" 14 "E27.40" "9/12/19" 15 "NA" "9/11/19" 16 "E89.0" "9/9/19" 16 "E05.00" "9/9/19" 17 "E11.9" "9/9/19" 18 "E03.9" "9/3/19" 19 "E11.9" "9/12/19" 20 "NA" "10/1/19" 21 "NA" "9/4/19" 22 "NA" "9/10/19" 23 "NA" "9/10/19" 24 "NA" "9/9/19" 25 "NA" "9/10/19" 26 "NA" "9/13/19" 27 "M81.0" "9/9/19" 27 "E83.42" "9/9/19" 28 "NA" "9/16/19" 29 "NA" "9/23/19" 30 "NA" "9/17/19" 31 "R97.20" "9/12/19" 31 "E29.1" "9/12/19" 32 "NA" "9/11/19" 33 "R74.8" "9/9/19" 33 "E05.00" "9/9/19" 33 "D64.9" "9/9/19" 33 "B18.2" "9/9/19" 33 "N18.30" "9/9/19" 33 "N18.30" "9/9/19" 33 "I10" "9/9/19" 33 "E05.00" "9/9/19" 33 "I42.8" "9/9/19" 34 "E10.8" "9/16/19" 35 "NA" "9/11/19" 36 "E27.1" "9/11/19" 37 "NA" "9/11/19" 38 "M81.0" "9/10/19" 38 "M06.9" "9/10/19" 38 "E83.42" "9/10/19" 39 "NA" "9/23/19" 40 "E11.9, Z79.4" "9/16/19" 41 "NA" "9/17/19" 42 "M81.0" "9/17/19" 43 "E87.1" "9/11/19" 43 "M19.90" "9/11/19" 43 "M81.0" "9/11/19" 44 "NA" "9/16/19" 45 "M81.0" "9/25/19" 45 "E03.9" "9/25/19" 46 "M81.0" "9/11/19" 47 "S72.446S" "9/11/19" 47 "M81.0" "9/11/19" 47 "Q79.60" "9/11/19" 47 "E55.9" "9/11/19" 48 "NA" "9/13/19" 49 "E78.5" "9/17/19" 49 "E06.3" "9/17/19" 49 "E11.9" "9/17/19" 50 "NA" "9/9/19" 51 "NA" "9/10/19" 52 "NA" "9/19/19" 53 "NA" "9/16/19" 54 "NA" "9/18/19" 55 "N92.6" "9/12/19" 55 "R53.83" "9/12/19" 55 "E06.3" "9/12/19" 56 "E03.9" "9/12/19" 57 "M81.0" "9/18/19" 58 "E03.9" "9/17/19" 59 "NA" "9/19/19" 60 "NA" "9/18/19" 61 "NA" "9/9/19" 62 "E89.0" "9/16/19" 62 "Z85.850" "9/16/19" 62 "E55.9" "9/16/19" 63 "D35.2" "9/24/19" 64 "NA" "9/17/19" 65 "E55.9" "9/23/19" 65 "E89.0" "9/23/19" 65 "Z85.850" "9/23/19" 66 "NA" "9/17/19" 67 "E11.9" "9/27/19" 68 "E55.9" "9/16/19" 68 "E04.1" "9/16/19" 68 "E03.9" "9/16/19" end
Comment