Hello all,
I am stuck on the following problem.
I have a group of 70 patients (variable = id) whom each have 30 corresponding ICD-9 codes (variable = dx1, dx2, dx3...dx30). I am trying to identify the top 10 ICD-9 codes among this group of patients, across all of the dx columns. I have tried going through and independently assessing each diagnosis group, and then summing the common ICD-9 codes in Excel. This seems to be quite labor intensive though, and I am sure there must be a better way to do this in STATA.
I have included a sample set of the data below, but truncated the dx code columns to just 3 instead of 30.
Any help you could provide would be much appreciated.
Kind regards,
Joe
I am stuck on the following problem.
I have a group of 70 patients (variable = id) whom each have 30 corresponding ICD-9 codes (variable = dx1, dx2, dx3...dx30). I am trying to identify the top 10 ICD-9 codes among this group of patients, across all of the dx columns. I have tried going through and independently assessing each diagnosis group, and then summing the common ICD-9 codes in Excel. This seems to be quite labor intensive though, and I am sure there must be a better way to do this in STATA.
I have included a sample set of the data below, but truncated the dx code columns to just 3 instead of 30.
Any help you could provide would be much appreciated.
Kind regards,
Joe
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float id str5(dx1 dx2 dx3) 1 "5712" "56729" "78959" 2 "5902" "0389" "99811" 3 "01400" "0389" "04104" 4 "20500" "51881" "78061" 5 "0389" "5849" "2875" 6 "1830" "56089" "19889" 7 "01486" "5679" "78959" 8 "56081" "56731" "01500" 9 "01485" "56723" "78959" 10 "01665" "01405" "78959" 11 "56089" "262" "56789" 12 "01404" "486" "01194" 13 "42823" "486" "261" 14 "78903" "01500" "73088" 15 "570" "5849" "07044" 16 "01404" "78959" "5119" 17 "01325" "0389" "56722" 18 "01485" "0549" "V6441" 19 "53783" "5849" "01193" 20 "042" "01894" "262" 21 "01890" "5720" "2639" 22 "01890" "2851" "78959" 23 "99668" "4589" "4148" 24 "78904" "01400" "7994" 25 "5601" "5723" "01190" 26 "01190" "56722" "01480" 27 "5571" "56729" "51884" 28 "2651" "01400" "51189" 29 "01406" "78959" "9982" 30 "0389" "56983" "01890" 31 "56983" "0389" "56729" 32 "01480" "78959" "9982" 33 "56081" "5679" "01890" 34 "01403" "99591" "0389" 35 "9920" "0389" "5849" 36 "57512" "01190" "78959" 37 "56889" "56723" "5849" 38 "56983" "01896" "56789" 39 "23691" "78552" "99668" 40 "5750" "5990" "99859" 41 "01402" "5119" "78959" 42 "042" "5679" "51881" 43 "0389" "56722" "78552" 44 "01485" "01205" "2639" 45 "042" "56789" "01190" 46 "7100" "5845" "51851" 47 "01406" "78959" "2631" 48 "01403" "5180" "5119" 49 "01400" "V427" "78959" 50 "78959" "56729" "01400" 51 "01484" "3484" "78060" 52 "01892" "56789" "5849" 53 "43491" "5849" "7580" 54 "5550" "56089" "7862" 55 "01400" "4019" "2449" 56 "042" "0312" "683" 57 "01895" "34400" "2761" 58 "0389" "042" "4019" 59 "1550" "042" "486" 60 "01480" "07044" "51881" 61 "5718" "01400" "5845" 62 "01145" "99592" "78552" 63 "5609" "51851" "55220" 64 "73313" "56731" "28419" 65 "56211" "56722" "042" 66 "56889" "01400" "78959" 67 "5722" "01404" "99592" 68 "01404" "51881" "0389" 69 "25041" "5856" "99656" 70 "01890" "56781" "57512" end
Comment