/* Two Sample T-test and Confidence Interval for the Mean BMI
Difference Between Males and Females */

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

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

proc ttest data=t01;
class gender;
var bmi;
run;

/********************************** ANNOTATED RESULTS **********************************/

                                 The SAS System

                               The TTEST Procedure

                                  Variable:  bmi

 gender          N        Mean     Std Dev     Std Err     Minimum     Maximum

 0              16     25.9375      3.1134      0.7783     20.8000     32.8000
 1              44     26.0318      4.0021      0.6033     17.3000     34.0000
 Diff (1-2)            -0.0943a     3.7923      1.1071

    gender        Method               Mean       95% CL Mean        Std Dev

    0                               25.9375     24.2785  27.5965      3.1134
    1                               26.0318     24.8151  27.2486      4.0021
    Diff (1-2)    Pooled            -0.0943     -2.3104   2.1218b     3.7923
    Diff (1-2)    Satterthwaite     -0.0943     -2.0954   1.9067

                gender        Method             95% CL Std Dev

                0                                2.2999   4.8186
                1                                3.3066   5.0707
                Diff (1-2)    Pooled             3.2103   4.6340
                Diff (1-2)    Satterthwaite

          Method           Variances        DF    t Value    Pr > |t|

          Pooled           Equal            58      -0.09      0.9324c
          Satterthwaite    Unequal      34.141      -0.10      0.9243

                             Equality of Variances

               Method      Num DF    Den DF    F Value    Pr > F

               Folded F        43        15       1.65    0.2915
            
        
a Mean BMI Difference
b 95% confidence interval for mean difference
c P-value indicating mean difference is not significantly different than zero.