Consider the following blood pressure log panel data:
The sample period is Januar/1/2024 to March/30/2024.
I would like to do the following:
(1) For each patient, I want to the starting and ending date of each log. For example, patient 101 might have logged for the entire sample twice a day its BP reading. Patient 104 might have logged twice a day starting mid-January and had a surgery and got disrcharged and the log stops mid February.
(2) For each patient, I want to compute the difference in its systolic and diastolic measures of the first entry and last entry (so two separate variables) in percents.
The purpose of this exercise is similar to what you would see in survival analysis. If a patient's log stops within the sample period, it means either the patient is deceased or was discharged from the hospital (after stabilization), and I want to know track the hospital entry-BP readings and the end-BP readings to follow through their progress.
Help is much appreciated!
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double logtime_01 float(patientid sys dia) 2.0213388e+12 100 140 82 2.0213928e+12 100 127 70 2.020662e+12 101 120 68 2.02077e+12 101 150 91 2.0232576e+12 102 155 93 2.0214108e+12 103 160 100 2.0214108e+12 103 120 69 2.0213028e+12 104 117 68 end format %tc logtime_01
I would like to do the following:
(1) For each patient, I want to the starting and ending date of each log. For example, patient 101 might have logged for the entire sample twice a day its BP reading. Patient 104 might have logged twice a day starting mid-January and had a surgery and got disrcharged and the log stops mid February.
(2) For each patient, I want to compute the difference in its systolic and diastolic measures of the first entry and last entry (so two separate variables) in percents.
The purpose of this exercise is similar to what you would see in survival analysis. If a patient's log stops within the sample period, it means either the patient is deceased or was discharged from the hospital (after stabilization), and I want to know track the hospital entry-BP readings and the end-BP readings to follow through their progress.
Help is much appreciated!

Comment