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

Hi,

 

I am trying to do a very simple FH test using a very simple 3X3 test using SAS 9.4. When I try a 2X2 table and the chi-square test it works but my 3X3 table just gets populated with ones after running the proc freq and I get wrong answers. Here is my code:

data mydata;
   input  outcome $ msgroup $ count;
   datalines;
inc PT 6 
inc FT 11
inc surg 12
dec PT 3
dec FT 4
dec surg 2
unch PT 8
unch FT 2
unch surg 3
;
run;

proc freq data=mydata;
   tables outcome*msgroup  / chisq exact;
run;

Do you know what is happening here? 

 

Thanks,

1 ACCEPTED SOLUTION

Accepted Solutions
Watts
SAS Employee

It looks like you probably need to add a WEIGHT statement. Otherwise, each observation is assigned a frequency of 1.  

Weight count;

View solution in original post

2 REPLIES 2
Watts
SAS Employee

It looks like you probably need to add a WEIGHT statement. Otherwise, each observation is assigned a frequency of 1.  

Weight count;
Primavera
Quartz | Level 8

Thank you very much. That was exactly what was missing from my proc freq.

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 2 replies
  • 264 views
  • 1 like
  • 2 in conversation