Here is an example of how my panel data is structured. I want to calculate the proportion of Afib patients with MI. For that, I would want to replace mi==1 in the same row as afib==1 only if the patient (by dupersid) has both afib and mi. Any help is appreciated.
dupersid icdcode afib mi
1 I10 0 0
1 I50 0 0
1 I25 0 1
1 M75 0 0
1 E78 0 0
1 I48 1 0
2 I21 0 0
2 I33 0 0
Thanks,
Harshith
dupersid icdcode afib mi
1 I10 0 0
1 I50 0 0
1 I25 0 1
1 M75 0 0
1 E78 0 0
1 I48 1 0
2 I21 0 0
2 I33 0 0
Thanks,
Harshith
Comment