I have 2 datasets with information on type and date of infection of each patients. They are from two different databases and I am trying to identify the earliest infection.
I have merged and identified the date of earliest infection:
Now that I have the earliest infection date, I cant figure out which command should I input to get the infection type based on the date I've identified
This is the example data:
For example, looking at row 1:
Patient was recorded as having a brain infection on the 1st database but chest on the second database. The dates showed that the brain infection occured first and I would like to generate a new variable which shows all of the earlier infections. Would appreciate any help, thanks
I have merged and identified the date of earliest infection:
Code:
egen earliest_infdate=rowmin(inf_date1 inf_date2)
This is the example data:
HTML Code:
patid inf_date1 inf_HES inf_date2 inf_cprd _merge earliest_infdate
2.231e+08 2007/12/19 Brain 2007/12/21 Chest Matched (3) 2007/12/19
5.215e+08 2014/12/24 Skin 2015/01/13 Chest Matched (3) 2014/12/24
9.407e+08 2011/08/04 Skin Master only (1) 2011/08/04
1.002e+09 2014/03/14 Skin 2014/03/01 Chest Matched (3) 2014/03/01
Patient was recorded as having a brain infection on the 1st database but chest on the second database. The dates showed that the brain infection occured first and I would like to generate a new variable which shows all of the earlier infections. Would appreciate any help, thanks

Comment