I have a dataset containing start and end dates of events across a number of subjects in long format (see data extract below). I'd like to start with the first recorded event per-patient, and remove any dates/events occurring within 14 days, and then repeat this process from the next available date (i.e. more than 14 days after the first) and so on.
The data initially looks like this:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str13 subjectid double(event_start event_end) "AA100" 20804 20818 "AA100" 20805 20819 "AA100" 20807 20821 "AA100" 20809 20823 "AA100" 20810 20824 "AA100" 20812 20826 "AA100" 20813 20827 "AA100" 20855 20869 "AA100" 20856 20870 "AA100" 20857 20871 "AA100" 21172 21186 "AA100" 21175 21189 "AA100" 21236 21250 "AA100" 21237 21251 "AA100" 21238 21252 "AA100" 21287 21301 end format %td event_start format %td event_end
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str13 subjectid double(event_start event_end) "AA100" 20804 20818 "AA100" 20855 20869 "AA100" 21172 21186 "AA100" 21236 21250 "AA100" 21287 21301 end format %td event_start format %td event_end
I hope that make sense, and thank you in advance.
Kind Regards,
Rob.
0 Response to Removing dates within a certain threshold in long format
Post a Comment