Dear analysts,
I am using STATA 16. It is a health dataset. I can identify cases by unique id(each patient has a unique ID). In addition, I have the date and the hour of measurement(Vitals like Heart rate, etc) and labs(Leucocytes, etc)
All data is in a long format. I have a core dataset with vitals and another dataset with blood labs.
The same patient has multiple rows or observations due to having multiple measurements during the same day (Vitals are measured up to 24 times a day - or each hour).
I have to bring the blood work into the Vitals file. The challenge is that the vitals are measured more frequently compared with blood works. I have to bring each blood work in the row with the vital - for the same hour or above the hour (for example for the Vital at 8 am - I need to bring the blood work from 9 am - the same day - but passed in the vitals row only up to the next blood work (for example if at 6 pm there was a second blood work - then I need to bring the blood work to the Vital, from 6 pm and 7 pm - up until next day when at 8 am are another Blood works. In summary, I need to bring the blood work to the closest Vital to have - Vitals and Blood labs together (morning Vitals with morning blood work). I wonder whether someone can guide how to bring together these datasets.
The Vitals dataset contains :
Unique ID for each patient(multiple rows for each patient)
Vitals name(Heart rate, etc)
Result
Date and Time (string)
The blood work dataset contains:
Unique ID for each patient (multiple rows for each patient)
Lab name(Leucocytes, etc)
Result
Date and Time (string)
Sincerely,
I am using STATA 16. It is a health dataset. I can identify cases by unique id(each patient has a unique ID). In addition, I have the date and the hour of measurement(Vitals like Heart rate, etc) and labs(Leucocytes, etc)
All data is in a long format. I have a core dataset with vitals and another dataset with blood labs.
The same patient has multiple rows or observations due to having multiple measurements during the same day (Vitals are measured up to 24 times a day - or each hour).
I have to bring the blood work into the Vitals file. The challenge is that the vitals are measured more frequently compared with blood works. I have to bring each blood work in the row with the vital - for the same hour or above the hour (for example for the Vital at 8 am - I need to bring the blood work from 9 am - the same day - but passed in the vitals row only up to the next blood work (for example if at 6 pm there was a second blood work - then I need to bring the blood work to the Vital, from 6 pm and 7 pm - up until next day when at 8 am are another Blood works. In summary, I need to bring the blood work to the closest Vital to have - Vitals and Blood labs together (morning Vitals with morning blood work). I wonder whether someone can guide how to bring together these datasets.
The Vitals dataset contains :
Unique ID for each patient(multiple rows for each patient)
Vitals name(Heart rate, etc)
Result
Date and Time (string)
The blood work dataset contains:
Unique ID for each patient (multiple rows for each patient)
Lab name(Leucocytes, etc)
Result
Date and Time (string)
Sincerely,
Comment