I have a data set detailing the diastolic blood pressure, systolic blood pressure and the date they were recorded - linked to a unique ID.
I would like to clean this file up and keep only the unique ID's with ≥ 2 recordings within a 2-year consecutive period.
(The actual file contains 72m observations spanning over ~12 years, but for the purpose of statalist have created a dummy of 20 observations)
Thank you.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str200 id long(diastolic_bp systolic_bp date) "a1" 90 148 15896 "a1" 90 160 15725 "a1" 98 168 15719 "a2" 90 150 14692 "a2" 90 150 15190 "a3" 90 140 15168 "a3" 90 150 14250 "a3" 90 150 14962 "a4" 90 190 15809 "a5" 100 150 15953 "a5" 100 160 15896 "a5" 90 140 14935 "a5" 90 150 15460 "a5" 90 150 15474 "a5" 90 160 16055 "a5" 94 140 15434 "a6" 90 150 14657 "a6" 92 158 15558 "a6" 94 150 15319 "a7" 100 150 15658 end format %d date
0 Response to How to keep >2 observations over 2-years
Post a Comment