Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Time-varying predictor for PROC MIXED

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 02-13-2017 07:35 PM
(5655 views)

Hello,

I have been searching from some resources, but seem to be stuck. I am looking at a treatment program (variable name is trtprogram) from 2000 (time 0) to 2007 (time 7). People could have been in (coded as 1) and out of the treatment program (coded as 0). But, I want to see it's affect on the outcome (variable name is: cd4). I am using a quadratic model because it fits the data the best. How do I best write and interepret this data? Below is my hypothesis but I am not sure if this is taking into account the time-varying predictor (trtprogram).

**proc** **mixed** data = work noclprint covtest;

class id trtprogram (ref='0');

model cd4 = time time2 trtprogram trtprogram*time trtprogram*time2/ ddfm=bw solution cl;

random intercept time time2/subject = id type = un;

**run**;

4 REPLIES 4

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

The only way I can think of to handle time varying covariates in PROC MIXED involves having time as a class variable, and fitting time*covariable with a noint option--and I'm not real happy with that approach.

PROC PHREG does better with this, although I have never tried it It appears that you could pull several of the examples in the documentation together to approach this. You would have no censoring (I assume), so between Example 85.7 Time-Dependent Repeated Measurements of a Covariate and Example 85.11 Analysis of Clustered Data, you might be able to get where you want to go.

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hello,

Thanks for the information. I believe it can be used with PROC MIXED. Wouldn't it be possible to put it in the Random Statement?

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

This isn't my area, but for what it's worth there is a similar problem in *SAS for Mixed Models* (2nd Ed), p. 190-196.

In that book, they let

t=time;

t2=time*time;

be continuous variables and they fit

class id trtprogram (ref='0') time;

model cd4 = trtprogram time t t2

trtprogram*time trtprogram*t trtprogram*t2 ;

The time-related variables are not included as random effects in the example. If you have access to that book, you might want to read that section to see if it is relevant to your data.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thanks for the example. I am thinking that the time-varying predictor...in this case would need to be in the Random Statement.

Maybe something like this...

**proc** **mixed** data = work noclprint covtest;

class id trtprogram (ref='0');

model cd4 = time time2 trtprogram/ ddfm=bw solution cl;

random intercept time time2 mcm_dico /subject = id type = un;

**run**;

Thoughts? Am I still able to say the change in CD4 cell counts based on Treat Program from this analysis?

Are you ready for the spotlight? We're accepting content ideas for **SAS Innovate 2025** to be held May 6-9 in Orlando, FL. The call is **open **until September 25. Read more here about **why** you should contribute and **what is in it** for you!

What is ANOVA?

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.