- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello , I have 2 groups (endovascular and surgical ) each one has good outcome and bad outcome , how can I calculate chi square for the difference between the two groups ? I am inputing these in SAS:
data procedure;
input procedrue $ good_outcome bad_outcome ;
cards;
surgical 500 200
endovascular 300 150
;
run;
Thanks
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@Khalid2015 wrote:
Hello , I have 2 groups (endovascular and surgical ) each one has good outcome and bad outcome , how can I calculate chi square for the difference between the two groups ? I am inputing these in SAS:
data procedure;
input procedrue $ good_outcome bad_outcome ;
cards;
surgical 500 200
endovascular 300 150
;
run;
Thanks
Chi-squares don't do 'difference between groups', they test difference in distributions between groups.
To do "difference between groups" you need to define how you are getting "difference".
Perhaps:
data procedure; input procedure $12. good_outcome bad_outcome; outcome='Good'; freq=good_outcome; output; outcome='Bad'; freq=bad_outcome; output; cards; surgical 500 200 endovascular 300 150 ; run; proc freq data=procedure; tables procedure*outcome/ chisq; weight freq; run;
Note creating a single variable with two levels from two variables. Using a frequency count to maintain the sample size information (more or less). This will generally be the better way to prepare data for most of the analysis procedures in SAS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
A CHI-SQUARE test can be requested by using the FREQ procedure:
data procedure;
input procedure $12. good_outcome bad_outcome;
cards;
surgical 500 200
endovascular 300 150
;
run;
proc freq data=work.procedure (where=(procedure="surgical")); /*or endovascular*/
table bad_outcome*good_outcome / chisq;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
hi qoit, I do not think this would solve. I need to compare surgical vs Endovacular. the "where" statemnt restricts one of the groups from the analysis
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@Khalid2015 wrote:
Hello , I have 2 groups (endovascular and surgical ) each one has good outcome and bad outcome , how can I calculate chi square for the difference between the two groups ? I am inputing these in SAS:
data procedure;
input procedrue $ good_outcome bad_outcome ;
cards;
surgical 500 200
endovascular 300 150
;
run;
Thanks
Chi-squares don't do 'difference between groups', they test difference in distributions between groups.
To do "difference between groups" you need to define how you are getting "difference".
Perhaps:
data procedure; input procedure $12. good_outcome bad_outcome; outcome='Good'; freq=good_outcome; output; outcome='Bad'; freq=bad_outcome; output; cards; surgical 500 200 endovascular 300 150 ; run; proc freq data=procedure; tables procedure*outcome/ chisq; weight freq; run;
Note creating a single variable with two levels from two variables. Using a frequency count to maintain the sample size information (more or less). This will generally be the better way to prepare data for most of the analysis procedures in SAS.