Hi folks,
I have a panel data of paitents in which each patient tracks its own blood pressure levels.
The time and day are determined by each individual, and some patients measure 3-4 times a day while some patients log only once a week.
I want to create a variable for systolic and diastolic that differences the preceding number in a chronological way.
What is the best way to create a new variable that tracks the changes in the systolic and diastolic numbers in a chronological order (e.g., latest - the second latest, the second latest - the third latest, and so on).
Appreciate your help!
I have a panel data of paitents in which each patient tracks its own blood pressure levels.
The time and day are determined by each individual, and some patients measure 3-4 times a day while some patients log only once a week.
I want to create a variable for systolic and diastolic that differences the preceding number in a chronological way.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte patientid str14 time int sys byte dia 1 "2023-11-17 23 " 123 77 1 "2023-11-18 08 " 135 80 1 "2023-11-18 15" 128 70 2 "2023-11-11 23 " 117 68 2 "2023-11-18 08 " 160 100 3 "2023-11-05 23 " 155 90 4 "2023-11-21 23 " 140 88 4 "2023-11-22 07 " 121 72 4 "2023-11-23 15" 120 70 end
Appreciate your help!
Comment