BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
fanuser
Calcite | Level 5

I have a simple dataset. Is it possible to obtain a p-value using the Cochran-Armitage test?  The following is the table:

Group

Successes

Total Trials

Proportion

1

20

500

0.04

2

30

1000

0.03

3

40

500

0.08

1 ACCEPTED SOLUTION

Accepted Solutions
SAS_Rob
SAS Employee

You have all the information you need.  You will just need to restructure your data set like the following:

data test;
input Group Successes Total;
cards; 
1 20 500 
2 30 1000
3 40 500
;
run;
data test2;
set test;
resp='y';ct=successes;output;
resp='n';ct=total-successes;output;
run;

proc freq data=test2 order=data;
weight ct;
tables resp*group/trend;
run;

View solution in original post

4 REPLIES 4
Ksharp
Super User

Yes. As long as your contingency table is 2xC or Rx2 , you can do Cochran-Armitage test.

But you need transform your data into this structure:

 

Ksharp_0-1741749784624.png

Ksharp_1-1741749811062.png

 

 

fanuser
Calcite | Level 5
How can I restructure my data to match the format you mentioned? I don't have any additional information.
Thanks!
SAS_Rob
SAS Employee

You have all the information you need.  You will just need to restructure your data set like the following:

data test;
input Group Successes Total;
cards; 
1 20 500 
2 30 1000
3 40 500
;
run;
data test2;
set test;
resp='y';ct=successes;output;
resp='n';ct=total-successes;output;
run;

proc freq data=test2 order=data;
weight ct;
tables resp*group/trend;
run;

fanuser
Calcite | Level 5
Thank you very much for providing such a wonderful solution!

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 4 replies
  • 966 views
  • 4 likes
  • 3 in conversation