BookmarkSubscribeRSS Feed
supreets89
Calcite | Level 5

Hi Everyone,

 

How can I test for significance using proportions in the following data:

Var                 X       Y     Z 

                A   50      60     10

                B   100   200    300    

 

If i want to show that the total proportion of Z in A (10/120)  is different from Z in B (300 /600), which test of significance would I use and how would i code it? My data is structured the following way:
v1    v2    v3
A      X     50
A      Y     60
A      Z     10
B      X    100

B      Y     200

B      Z     300

 

I know Chi-sq would compare proportions in all three columns together, but how can i focus the significance test to just Z in A vs Z in B.

4 REPLIES 4
PaigeMiller
Diamond | Level 26

You could compare the two proportions using the formula here:

 

https://onlinecourses.science.psu.edu/stat500/node/55

 

just underneath the heading "Hypothesis Testing to Compare Two Population Proportions: p1,p2" (this assumes that groups A and B are independent, statistically)

 

You could use PROC FREQ to obtain the proportions, and then the formula itself isn't hard to program in a data step.

--
Paige Miller
StatDave
SAS Super FREQ

All you care about is Z and not Z - the separate X and Y levels can be combined. PROC FREQ can do the chi-square test for you:

 

data a;
input r $ c $ count;
datalines;
A notZ 110
A Z     10
B notZ 300
B Z    300
;
proc freq;
table r*c / chisq;
weight count; 
run;
Ksharp
Super User

Or you want do Trend Analysis ?

 

proc freq;

table v1*v2/trend;

run;

sld
Rhodochrosite | Level 12 sld
Rhodochrosite | Level 12

I think that the solution suggested by @SAS_Rob in this current Community thread Chi square test of association which links to this note http://support.sas.com/kb/22/565.html would provide you with the tools you need.

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 1631 views
  • 2 likes
  • 5 in conversation