Dear all,
I have a dataset of patient referrals, some of which have multiple inputs. I want to remove any duplicate referrals for the same patient within the same 7 day period, keeping only the first observation.
So if a referral was made for patient x at time t, then again at time t+2 and again at t+5, I want to keep only the referral at time t and remove the subsequent two. But any referral made past the t+6 mark should be kept.
The data is as follows:
patid referraldate
12 22/06/2020 15:05
65 19/04/2019 17:26
172 19/09/2019 13:55
172 14/10/2019 11:44
294 05/12/2018 10:19
339 21/02/2021 22:38
648 24/07/2020 17:24
846 29/04/2019 18:39
with patid being Patient ID and referral date the date and time of referral
I have reformatted referral date into a variable daytime that is a double if that helps
I have managed to do this in R, but need to perform it again in Stata and am quite inexperienced.
I hope this makes sense, and that someone can advise me how to do this
Many thanks in advance!
I have a dataset of patient referrals, some of which have multiple inputs. I want to remove any duplicate referrals for the same patient within the same 7 day period, keeping only the first observation.
So if a referral was made for patient x at time t, then again at time t+2 and again at t+5, I want to keep only the referral at time t and remove the subsequent two. But any referral made past the t+6 mark should be kept.
The data is as follows:
patid referraldate
12 22/06/2020 15:05
65 19/04/2019 17:26
172 19/09/2019 13:55
172 14/10/2019 11:44
294 05/12/2018 10:19
339 21/02/2021 22:38
648 24/07/2020 17:24
846 29/04/2019 18:39
with patid being Patient ID and referral date the date and time of referral
I have reformatted referral date into a variable daytime that is a double if that helps
I have managed to do this in R, but need to perform it again in Stata and am quite inexperienced.
I hope this makes sense, and that someone can advise me how to do this
Many thanks in advance!
Comment