BookmarkSubscribeRSS Feed
sas14
Calcite | Level 5

how to calculate Chi-squared 2x2 test (Fischer’s exact test, two-tailed) to get an p value using sas.

 

 

9 REPLIES 9
ballardw
Super User

Basic

 

Proc freq data=have;

   tables var1*var2 / chisq fisher;

run;

sas14
Calcite | Level 5

how to calculate for below data

 

(PERCENTAGES)  
A1000
b1631.1655629.49382
c12.893.9632512.35552
d33.4276437.2905828.69669
e31.2585123.2570724.27262
f3.3532434.3235455.181347
Total100100100
Reeza
Super User

Chi-Square is for count data, you don't appear to have count data.

ballardw
Super User

That is also NOT 2x2 data.

sas14
Calcite | Level 5
 200020012002
(PERCENTAGES)  
A0.10478900
B293129.9
c2.312.4
d333728.7
e312324.3
f345.2
Total100100100

i need to calculate 2000 vs 2001;2001vs 2002 ...

ballardw
Super User

Do you have actual counts or possibly even better data with one record per observation?

You can get significantly different results comparing percentages when the percentages are the same but the group counts differ significantly.

sas14
Calcite | Level 5

this is the only  data availble ....

Reeza
Super User

Then you need to explain your question. You need the N's even if it's just the total and you back calculate the N based on percentages. 

 

If you don't have N's you can calculate the variance and you can't do any tests. 

 

There's a difference between tossing two coins and getting two heads versus tossing a coin 100 times and getting 100 heads.

 

 

sas14
Calcite | Level 5

 

 

 

2000-2005

2006-2010

C

277

162

d

898

448

 

for this type of p value, you want to calculate a Chi-squared 2x2 test (Fischer’s exact test, two-tailed). So for example, for C, you would do…

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 9 replies
  • 1538 views
  • 0 likes
  • 3 in conversation