/* Many Sample Test for Unequal Binomial Proportions */

filename t01 url 'http://hedwig.mgh.harvard.edu/biostatistics/sites/default/files/public/education/tmp_sample_data.csv';

proc import file=t01 out=t01 dbms=csv replace;
run;

proc freq data=t01;
table diabetes*race/ chisq;
run;
/********************************** ANNOTATED RESULTS **********************************/

                              The FREQ Procedure

                           Table of diabetes by race

                  diabetes     race

                  Frequency|
                  Percent  |
                  Row Pct  |
                  Col Pct  |       1|       2|       3|  Total
                  ---------+--------+--------+--------+
                         0 |     20 |     17 |      6 |     43
                           |  33.33 |  28.33 |  10.00 |  71.67
                           |  46.51 |  39.53 |  13.95 |
                           |  64.52 |  89.47 |  60.00 |
                  ---------+--------+--------+--------+
                         1 |     11 |      2 |      4 |     17
                           |  18.33 |   3.33 |   6.67 |  28.33
                           |  64.71 |  11.76 |  23.53 |
                           |  35.48 |  10.53 |  40.00 |a
                  ---------+--------+--------+--------+
                  Total          31       19       10       60
                              51.67    31.67    16.67   100.00


                    Statistics for Table of diabetes by race

             Statistic                     DF       Value      Prob
             ------------------------------------------------------
             Chi-Square                     2      4.4179    0.1098b
             Likelihood Ratio Chi-Square    2      4.9576    0.0838
             Mantel-Haenszel Chi-Square     1      0.1587    0.6904
             Phi Coefficient                       0.2714
             Contingency Coefficient               0.2619
             Cramer's V                            0.2714

                                Sample Size = 60
            
        
a This row shows 35.48% (11/31) of race 1, 10.53% (2/19) of race 2, and 40.00% (4/10) of race 3 are diabetic
b Chi-square test p-value indicating proportion of diabetics not significantly different by race