BookmarkSubscribeRSS Feed
twotwotwo
Calcite | Level 5

Hi,

I performed a mixed model procedure and in this procedure, I used group as the fixed effect.  The group is a categorical variable and has 4 level.  And I want to compare the difference between each group with the contrast statement.  Here is my code:

proc mixed data=test;

by brand;

class name;

model price=group;

contrast 'group1 vs2' group 1 -1 0 0;

contrast 'group1 vs3' group 1 0 -1 0;

contrast 'group1 vs4' group 1 0 0 -1;

run;

However, I got 3 SAME contrast p-value.  But those 4 groups are different from each other.  Why I got the same p-value for those 3 comparisons?  Thanks!

7 REPLIES 7
art297
Opal | Level 21

Seeing the data might help someone trying to answer your question.

twotwotwo
Calcite | Level 5

Thanks for your response. Please see the attached.  I only put part of my data.  Thanks.

twotwotwo
Calcite | Level 5

Please see my attachment for the data.  Thanks!

Doc_Duke
Rhodochrosite | Level 12

I think that the problem is in your CLASS statement.  I think that it should read

CLASS group;

Doc Muhlbaier

Duke

twotwotwo
Calcite | Level 5

Thanks for your reply.  I really want CLASS name; How can I correct them? thanks!

Reeza
Super User

SAS isn't considering GROUP a categorical variable if its not in the class statement.

You might want to include in your BY statement perhaps, ie a separate model for each value of name? or you can have both in the class statement.

CLASS group name;

Not sure, depends on what you're trying to do.

twotwotwo
Calcite | Level 5

Thanks!  It then gave me three different p-value.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

Discussion stats
  • 7 replies
  • 1774 views
  • 0 likes
  • 4 in conversation