BookmarkSubscribeRSS Feed
Innocent
Calcite | Level 5

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 MIXEDMANOVA

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.

4 REPLIES 4
SteveDenham
Jade | Level 19

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

Innocent
Calcite | Level 5

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

Innocent
Calcite | Level 5

One more question,

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

SteveDenham
Jade | Level 19

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 975 views
  • 0 likes
  • 2 in conversation