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!

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!

Register now

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