Hi,
I've been trying to analyze a dataset containing survey data collected from several clinic follow ups but having problem to extract specific data from it. Here's some brief description of my dataset:
ID j Date Eval score Hospitalization in the past 6 months
1 1 1/1/2019 . N
1 2 2/5/2019 5 Y
2 1 5/1/2018 4 N
3 1 1/1/2019 7 N
3 2 7/10/2019 4 Y
3 3 8/10/2019 5 N
3 4 2/1/2020 6 N
4 1 1/1/2019 . N
4 2 9/1/2019 8 N
4 3 4/5/2020 6 Y
In the dataset, we have around 2000 surveys, some patients filled out only once, some multiple times. I created a variable 'j' for each ID to represent the visit #. I really need help for the steps I am trying to do:
(1) Exclude those who only filled out 1 survey.
(2) For those who had 2 or more surveys, I want to include the 'first' survey with the eval score (could be #2 survey or #3 survey for the patient). eg. in the sample dataset above, exclude #1 survey of patient 4 and use #2.
(3) I want to find the next survey which is 6-12 months after the first survey included in step (2), and use the hospitalization data in that survey as the outcome.
I've been searching different forums trying to figure out how to code these steps but I think it is beyond my knowledge and would really appreciate your input and help!
Thank you in advance!
Joseph
I've been trying to analyze a dataset containing survey data collected from several clinic follow ups but having problem to extract specific data from it. Here's some brief description of my dataset:
ID j Date Eval score Hospitalization in the past 6 months
1 1 1/1/2019 . N
1 2 2/5/2019 5 Y
2 1 5/1/2018 4 N
3 1 1/1/2019 7 N
3 2 7/10/2019 4 Y
3 3 8/10/2019 5 N
3 4 2/1/2020 6 N
4 1 1/1/2019 . N
4 2 9/1/2019 8 N
4 3 4/5/2020 6 Y
In the dataset, we have around 2000 surveys, some patients filled out only once, some multiple times. I created a variable 'j' for each ID to represent the visit #. I really need help for the steps I am trying to do:
(1) Exclude those who only filled out 1 survey.
(2) For those who had 2 or more surveys, I want to include the 'first' survey with the eval score (could be #2 survey or #3 survey for the patient). eg. in the sample dataset above, exclude #1 survey of patient 4 and use #2.
(3) I want to find the next survey which is 6-12 months after the first survey included in step (2), and use the hospitalization data in that survey as the outcome.
I've been searching different forums trying to figure out how to code these steps but I think it is beyond my knowledge and would really appreciate your input and help!
Thank you in advance!
Joseph


Comment