Statistical Procedures

Programming the statistical procedures from SAS
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-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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