Hi,
I have a dataset where participants eGFR observations are longitudinal in nature. That is 1 person might have many eGFR observation. However, I am only interested in the values three years prior and one year after the treatment date in order for them to define cases. I have arrived at a point where I have kept all the observations by each person who have eGFR values recorded three year before date_record and one year after date_record.
In order to define cases, I am interested if the observation only has egfr60 for a participant within three year prior and one year after txt_date, then I wish to exclude participants from my data. At the moment I am having problem to code this part. I am creating a sample data below
I have uploaded a dummy sample data for your reference.
Any help would be appreciated.