I have a panel dataset organized months: Month 0, Month 6, Month 12, and Month 18. Other variables in the dataset are participant ID, group, and sbp (the outcome variable). How do I calculate a new variable representing the change from baseline for the difference between Month 0 vs. Month 6, Month 0 vs Month 12, and Month 0 vs. Month 18? A sample dataset is attached. Your help will be appreciated.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte(id group time) double sbp 1 1 0 129.5 1 1 6 121.5 1 1 12 120 1 1 18 120 2 2 0 140 2 2 6 138 2 2 12 136 2 2 18 126 3 3 0 125.8 3 3 6 123.6 3 3 12 120.5 3 3 18 120 4 4 0 118.6 4 4 6 117.9 4 4 12 116.9 4 4 18 115.9 end
Comment