turn on suggestions

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

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- General Programming
- /
- Proc Mixed with repeated measurement: Help needed

Topic Options

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-13-2012 05:50 AM

I am new to statistics in general and particularly to SAS, and I would like to get help solving my problem, as following:

I have a 50 patients divided into three groups (1, 2, and 3) according to their diastolic pressure. For each patient, I measure 10 different parameters (e.g. Bicarbonate concentration, Heart rate, glucose concentration, blood volume, etc.). Each parameter was measured once every hour for five consecutive hours during the day; all measurements on patients were done at exact same time moments. Unfortunately, I have some missing data (not all parameters could be measured always).

**I am trying to study if there is significant difference in parameters between the groups, and if the parameters change significantly during time.**

I have been suggested to use PROC MIXED to achieve that, and MANOVA statement from PROC GLM to see if we can differentiate between groups from only the first measurement of maximum five parameters. Here is the codes:

PROC MIXED | MANOVA |
---|---|

proc sort data=database1; by id zeit ; run; proc mixed data=database1; class group zeit; model HR Glu BV K HCO3 Temp Na SPO2 BP We= group zeit group*zeit /residual; repeated zeit /type=ar(1); lsmeans group; lsmeans group /pdiff; run; | proc glm data=database1; class group; model HR BV K Glu = group /ss3; means group; contrast '3 vs 1&2' group 2 -1 -1 1; contrast '1 vs 3' group 0 1 -1 1; manova h=_all_; run; |

**Can anyone explain to me these codes and check if they both are correct and suitable for my study.**

Thanks in advance.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Innocent

10-15-2012 09:19 AM

There is going to be difficulties with both of these codes. PROC MIXED accepts only a single dependent variable, so you will have to try the following:

First, get the data into a "long" format.

data long;

length varname $6.;

set database1;

varname='HR'; value=HR;output;

varname='Glu'; value=Glu;output;

varname='BV';value=BV;output;

varname='K';value=K;output;

varname='HCO3';value=HCO3;output;

varname=Temp';value=Temp;output;

varname='Na';value=Na;output;

varname='SPO2';value=SPO2;output;

varname='BP';value=BP;output;

varname='We';value=we;output;

keep group zeit varname id value;

run;

proc sort data=long;

by varname id zeit ;

run;

/* Now run proc mixed by varname. I made some changes in the class statement, model statement and the repeated statement. I added id to the class statement so that the correlations within subject would be correctly estimated. In the model statement, DDFM=KR2 is only available in SAS/STAT12.1, so if you are not on that version, change this to DDFM=kr(firstorder). I added a subject=id to the repeated statement. This should provide the analysis you are seeking. */

proc mixed data=long;

by varname;

class id group zeit ;

model value= group zeit group*zeit /ddfm=kr2;

repeated zeit /type=ar(1) subject=id;

lsmeans group;

lsmeans group /pdiff;

run;

For the MANOVA in PROC GLM, there is a problem with the contrast statements. There are four coefficients given but only three groups. Try the following:

proc glm data=database1;

class group;

model HR BV K Glu = group /ss3;

means group;

contrast '3 vs 1&2' group 2 -1 -1 ;

contrast '1 vs 3' group 0 1 -1 ;

manova h=_all_;

run;

I hope this helps.

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SteveDenham

10-16-2012 08:59 AM

Thanks a lot for the help. I still have three more questions,

1- As I understand Proc Mixed statement is better choice than GLM especially if the database contains some missing values. So, can I apply MANOVA with Proc Mixed; and how?

2- In the new code you sent me, what does "value" represents in: "model value= group zeit group*zeit /ddfm=kr2"?

3- Why "subject=id" is added to the repeated statement?

Thanks again very much.

Haithum Anouar

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SteveDenham

10-16-2012 10:33 AM

One more question,

What does the number in the MANOVA code indicates (e.g. contrast '3 vs 1&2' group 2 -1 -1)?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Innocent

10-16-2012 01:06 PM

I will try to reply to all four questions>

1. There are ways to do multivariate analyses in PROC MIXED. In this case, doubly repeated measures comes to mind. See for example the documentation for TYPE=UN@AR(1) under the REPEATED statement. It gives a short example using height and weight of subjects measured over several years. In this case, you might try:

proc mixed data=long;

class id varname group zeit ;

model value= varname group zeit group*zeit group*varname varname*zeit group*varname*zeit /ddfm=kr2;

repeated varname zeit /type=un@ar(1) subject=id;

lsmeans group*varname group*varname*zeit/diff;

run;

Be aware that this is a very resource intensive model. The Kronecker product generates a very large matrix.

2. Value is the value that any of the variables takes on. Take a close look at the wide-to-long DATA step, and you will see that the number in each of the dependent variables is assigned to "value".

3. Subject=id is added to the repeated statement is needed to specify the variable identifying the individuals which were measured repeatedly. Without it, you cannot separate variability into within and between subject sources.

4. Look at the documentation for the CONTRAST statement for almost any of the procedures. These numbers are the coefficients of the contrast. Below is a corrected version, as what I presented before was not correct:

proc glm data=database1;

class group;

model HR BV K Glu = group /ss3;

means group;

contrast '3 vs 1&2' group -1 -1 2 ;

contrast '1 vs 3' group 1 0 -1 ;

manova h=_all_;

run;

For contrast '1 vs 3' group 1 0 -1, it means to take the difference between the least squares mean of the first group and the last group, i.e. **1***xbar1 + **0***xbar2 **- 1***xbar3. For contrast '3 vs 1&2' group -1 -1 2 , it means take twice the mean of the third group and subtract the means of the first two groups, i.e., **-1***xbar1 **-1***xbar2 +**2***xbar3

Note that the coefficients must sum to zero. Check out any decent text on linear models for a discussion of contrasts.

I hope this helps.

Steve Denham