Hello,
I am trying to model blood pressure growth trajectories across two distinct periods (reactivity and recovery from a stressor). I am looking to examine rates of linear growth for levels of bp for each person within each period. I also include person-level predictors.
I am currently modeling blood pressure as a function of each time point. However, there are 8 time points (4 during the reactivity phase and 4 during the recovery phase), and I would like to divide time into two periods, before minute 4 and after minute 4.
Here is my SAS code modeling each time point (I use SAS 9.4):
proc mixed data=third;
class condition time;
model systolic = time|condition;
repeated time / sub=id type=un;
lsmeans time|condition;
run;
How can I create a spline model where I can get two separate coefficients (one before time=4 and one after time=4)?
Thank you!
Change my time of 12 to your time of 4.
data x;
set sashelp.class(rename=(age=time));
time1 = (time <= 12) * time;
time2 = (time > 12) * time;
run;
You mentioned splines, but your code does not appear to use splines. When you use the EFFECT statement to construct the spline, put a knot at time=4. That will enable you to create a piecewise linear model. See the second example in the article "Nonsmooth models and spline effects."
Thank you, Rick! This was very helpful.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.