Programming the statistical procedures from SAS

Why my contrast statement gave me only one p-value?

Reply
Contributor
Posts: 20

Why my contrast statement gave me only one p-value?

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!

PROC Star
Posts: 7,416

Why my contrast statement gave me only one p-value?

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

Contributor
Posts: 20

Re: Why my contrast statement gave me only one p-value?

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

Attachment
Contributor
Posts: 20

Why my contrast statement gave me only one p-value?

Please see my attachment for the data.  Thanks!

Trusted Advisor
Posts: 2,114

Why my contrast statement gave me only one p-value?

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

CLASS group;

Doc Muhlbaier

Duke

Contributor
Posts: 20

Why my contrast statement gave me only one p-value?

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

Super User
Posts: 18,568

Why my contrast statement gave me only one p-value?

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.

Contributor
Posts: 20

Why my contrast statement gave me only one p-value?

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

Ask a Question
Discussion stats
  • 7 replies
  • 177 views
  • 0 likes
  • 4 in conversation