Hi everyone,
I am working with a dataset and want to Identify the three most common ICD-10 codes (observation) among diagnosis codes (20 DX codes DX1-DX20). In fact, I am wondering how many times patients are diagnosis for example for "M054", "M055", "M057", "M058", "M060", "M062", "M063", "M068", "M069", "M120" between DX1 to DX20.
Also, I am assigned to have two subgroups: RA covers "M054", "M055", "M057", "M058", "M060", "M062", "M063", "M068", "M069", "M120" and
Other RA includes "M050", "M051", "M052", "M053", "M056", "M061"
I used this code:
This command helps me to define "RA" and"Other RA" through DSdx1-DSdx20. But my problem is I don't know how to calculate the most frequent ICD codes in "RA" and "Other RA"
I am working with a dataset and want to Identify the three most common ICD-10 codes (observation) among diagnosis codes (20 DX codes DX1-DX20). In fact, I am wondering how many times patients are diagnosis for example for "M054", "M055", "M057", "M058", "M060", "M062", "M063", "M068", "M069", "M120" between DX1 to DX20.
Also, I am assigned to have two subgroups: RA covers "M054", "M055", "M057", "M058", "M060", "M062", "M063", "M068", "M069", "M120" and
Other RA includes "M050", "M051", "M052", "M053", "M056", "M061"
I used this code:
Code:
foreach v of varlist dx1-dx20 { gen S`v' = "RA" if inlist(substr(`v', 1, 4), "M054", "M055", "M057", "M058", "M060", "M062", "M063", "M068", "M069", "M120") replace S`v'= "Other_RA" if inlist(substr(`v', 1, 4), "M050", "M051", "M052", "M053", "M056", "M061") encode S`v', gen(DS`v') replace DS`v'=0 if DS`v'==. }
Code:
DMdx1 DMdx2 DMdx3 DMdx4 DMdx5 DMdx6 0 M069 0 0 0 0 0 0 0 0 0 0 M069 0 0 0 0 0 0 0 0 0 0 M069 0 0 0 0 0 0 0 0 0 0 M069 0 0 0 0 0 0 0 0 0 0 M069 0 0 0 0 0 0 0 0 0 0 M069 0 0 0 0 0 0 0 0 0 0 M069 0 0 0 0 0 0 0 0 0 0 M069 0 0 0 0 0 0 0 0 0 0 M069 0 0 0 0 0 0 0 0 0 0 M069 0 0 0 0 0 0 0 0 0 0 M069 0 0 0 0 0 0 0 0 0 0 M069 0 0 0 0 0 0 0 0 0 0 M069 0 0 0 0 0 0 0 0 0 0 M069 0 0 0 0 0 0 0 0 0 0 M069 0 0 0 0 0 0 0 0 0 M0510 0 0 0 0 0 0 0 0 0 0 M0510 0 0 0 0 0 0 0 0 0 0 M0510 0 0 0 0 0 0 0 0 0 0 M0510 0 0 0 0 0 0 0 0 0 0 M0510 0 0 0 0 0 0 0 0 0 0 M06041 0 0 0 0 0 0 0 0 0 0 M06051 0 0 0 0 0 0 0 0 0 0 M06071 0 0 0 M06072 0 0 0 0 0 0 M06071 0 M064 0 0 0 0 0 0 0 0 M06072 0 0 0 0 0 0 0 0 0 0 M0609 0 0 0 0 0 0 0 0 0 0 M0609 0 0 0 0 0 0 0 0 0 0 M0609 0 0 0 0 0 0 0 0 0 0 M0609 0 0 0 0 0 0 0 0 0 0 M06322 0 0 0 0 0 0 0 0 0 0 M06322 M06341 0 0 0 0 0 0 0 0 0 M06331 0 0 0 0 0 0 0 0 0 0 M06341 0 0 0 0 0 0 0 0 0 0 M06342 0 0 0 0 0 0 0 0 0 0 M06342 0 0 0 0 0 0 0 0 0 0 M064 0 0 0 0 0 0 0 0 0 0 M064 0 0 0 0 0 0 0 0 0 0
Comment