I have 1000 persons data with 5 years' annual bone mineral density (BMD) measurement. Now I want to get the bone mineral density (BMD) change rate per year. Because this is longitudinal data, I think I should use proc mixed.
My data is like:
id visit group bmd
1 0(baseline) a 1.01
1 1 a 1.00
1 2 a 1.00
1 3 a 0.99
1 4 a 0.98
1 5 a 0.96
2 0(baseline) b 1.07
2 1 b 1.06
2 2 b 1.04
2 3 b 0.99
2 4 b 0.95
2 5 b 0.93
......
My code is :
PROC MIXED DATA=mydaa noclprint;
CLASS id visit group;
MODEL bmd = visit group group*visit / SOLUTION CL DDFM=KR OUTPM=aaa;
REPEATED visit / SUBJECT=id TYPE=UN R RCORR;
RUN;
Is this code correct? and where can I get the change rate in the output? I read one paper said the estimate is the change rate, but the numbers are positive (the change rate should negative).
And I plot the result like this:
PROC SGPLOT DATA=aaa;
SERIES x = visit y = pred / GROUP = group MARKERS;
RUN;
The plot looks correct. But how can I get the numbers for the slop?
Thank you very much for your help.
The estimate is only the estimate of the dependent variable. Here, the dependent variable is bmd, is bmd a change rate? Looking at the structure I would say it isn't. Assuming I am correct I would suggest you create baseline variable and then from that and bmd calculate the change and use the change variable as the dependent variable and also include baseline into the model.
Thanks for your reply. If I understand correctly, the coefficient of the interaction term (group * visit) (i.e. the slop of the model) is the change rate.
If you just want to find the slop I would suggest to follow this tutorial by Rick Wicklin
https://blogs.sas.com/content/iml/2013/02/27/slope-of-a-regression-line.html
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.