Below is part of my dataset.
What I want to do is that for each id (row), I want to only keep the first time(earlist) the icd code including "I" appears and its diagnose date.
Could anyone help with this issue?
Thank you in advance!
Best regards,
Z
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long id int outdia_date1 str4(out_mainicd1 out_contriicd1) byte out_contriicd2 int india_date1 str4(in_mainicd1 in_contriicd1) byte in_contriicd2 int india_date2 str4(in_mainicd2 in_contriicd1 in_contriicd2 in_contriicd3) 2411188 19631 "R104" "I489" . 19631 "R104" "I489" . 21080 "R060" "R509" "R230" "I480" 2451736 17883 "I849" "" . 17883 "I849" "" . 17783 "C900" "I109" "" "" end format %tdnn/dd/CCYY outdia_date1 format %tdnn/dd/CCYY india_date1 format %tdnn/dd/CCYY india_date2
0 Response to How to only keep the target icd code and its diagnose date for each obs?
Post a Comment