How to compare the difference between each two groups?

Reply
Frequent Contributor
Posts: 86

How to compare the difference between each two groups?

Dear SAS users,

I have the following data set created by a data procedure, what analysis method should I use so that I can know whether there is significant difference between each 2 groups regard to the performance (3 lelvels as Good, Mediate and Bad)?

Since the data is frequency data at each performance level in each group, thus I have no idea.

data result;

     input performance $ group $ frequency@@;

     datalines;

     Good Gp1 10 Mediate Gp1 15 Bad Gp1 6

     Good Gp2 12 Mediate Gp2 13 Bad Gp2 6

     Good Gp3 10 Mediate Gp3 10 Bad Gp3 11

     ;

run;

Thanks for your help.

Frank Green

Super User
Posts: 9,691

Re: How to compare the difference between each two groups?

Corresponding Analysis ?

Ask Dr.

Ksharp

Trusted Advisor
Posts: 1,631

Re: How to compare the difference between each two groups?

Seems like a chi-squared test in PROC FREQ will answer the question.

Frequent Contributor
Posts: 86

Re: How to compare the difference between each two groups?

I am afraid, I can't agree with you. If you think freq procedure works, please let me check your code. Per  my understanding, we can't use Freq to do this.

Anyway, still thanks for your reply.

Super User
Posts: 9,691

Re: How to compare the difference between each two groups?

That would not. chi-squared test is used to check relations between column and row variables.

SAS Employee
Posts: 23

Re: How to compare the difference between each two groups?

Hi!

I am not a statistician, so I should probably stay out of this thread... Read this with a pinch of salt...

If we have the null hypothesis than there is no difference in the distribution of performance between groups, the code below will give us a p-value of 0.49. So, there is no significant difference between groups.

proc freq data=result;

  table group*performance / chisq;

  weight frequency;

run;

Super User
Posts: 9,691

Re: How to compare the difference between each two groups?

"the code below will give us a p-value of 0.49. So, there is no significant difference between groups."

That maybe should said there is no significant relative between groups and performance .

Dr. may give us the exact answer .

Ksharp

Contributor
Posts: 43

Re: How to compare the difference between each two groups?

Also you can do (and test with exact trend if you have combine performance into two level):

ods graphics on;

proc freq data=result;

weight frequency;

tables performance*group / chisq cmh measures cl

        plots=freqplot(twoway=stacked);

   test smdrc;

run;

ods graphics off;

Respected Advisor
Posts: 2,655

Re: How to compare the difference between each two groups?

The follow-up pairwise comparisons are the only tricky issue.  Note that the overall test is not significant, so the p values for pair-wise comparisons are bound to be liberal.  My thought is to use exact frequency methods, so I don't understand the objection to PROC FREQ, unless there are other factors involved.

First, the overall test:

proc freq data=result;

weight frequency;

tables performance*group /all;

exact fishers agree;

run;

Then the pair-wise comparisons:

proc freq data=result;

where group in ('Gp1',' Gp2');

weight frequency;

tables performance*group /all;

exact fishers agree;

run;

proc freq data=result;

where group in ('Gp1',' Gp3');

weight frequency;

tables performance*group /all;

exact fishers agree;

run;

proc freq data=result;

where group in ('Gp2',' Gp3');

weight frequency;

tables performance*group /all;

exact fishers agree;

run;

However, there is nothing significant in any of the tests here.

Steve Denham

Ask a Question
Discussion stats
  • 8 replies
  • 506 views
  • 0 likes
  • 6 in conversation