SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
PSZ
Calcite | Level 5 PSZ
Calcite | Level 5

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.

3 REPLIES 3
rbikes
Obsidian | Level 7

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.

PSZ
Calcite | Level 5 PSZ
Calcite | Level 5

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. 

rbikes
Obsidian | Level 7

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-white.png

Join us for our biggest event of the year!

Four days of inspiring keynotes, product reveals, hands-on learning opportunities, deep-dive demos, and peer-led breakouts. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1618 views
  • 0 likes
  • 2 in conversation