Example SAS code for a two-sample T-Test:

 

data efh;

   input cond $ test msat;

   label cond = 'Experimental condition';

   label test = 'Fraction correct on post-test';

   label msat = 'Math SAT score';

   datalines;

A       0.71    650

A       0.82    710

A       0.82    510

A       0.76    590

A       0.76    500

A       0.71    730

A       0.71    570

A       0.82    780

B       0.65    690

B       0.53    710

B       0.88    780

B       0.59    690

B       0.76    730

B       0.59    700

B       0.65    740

;

 

proc print data=efh;

run;

 

proc ttest data=efh;

   class cond;

   var test;

run; 

    

Partial Output from the above code:

 

                              TTEST PROCEDURE

 

Variable: TEST         Fraction correct on post-test

 

COND       N                 Mean              Std Dev            Std Error

---------------------------------------------------------------------------

A          8           0.76375000           0.05097268           0.01802156

B          7           0.66428571           0.11914377           0.04503211

 

Variances        T       DF    Prob>|T|

---------------------------------------

Unequal     2.0506      7.9      0.0749

Equal       2.1553     13.0      0.0505

 

For H0: Variances are equal, F' = 5.46    DF = (6,7)    Prob>F' = 0.0422 

 

With unequal variances, the p-value of .07 provides only marginal evidence that the means of the two populations are not equal.

 

Example SAS code for a paired-difference T-Test:

 

data hci;

   input new old;

   label new = 'Time in minutes needed with new interface';

   label old = 'Time in minutes needed with old interface';

   improv=old-new;

   datalines;

4.5 5.2

4.2 5.7

3.4 3.2

4.3 5.1

4.3 4.5

3.9 3.7

4.7 5.1

3.4 3.4

;

 

proc print data=hci;

run;

 

proc univariate data=hci;

   var improv;

run;

 

Partial Output from the above code:

 

                        OBS    NEW    OLD    IMPROV

 

                         1     4.5    5.2      0.7

                         2     4.2    5.7      1.5

                         3     3.4    3.2     -0.2

                         4     4.3    5.1      0.8

                         5     4.3    4.5      0.2

                         6     3.9    3.7     -0.2

                         7     4.7    5.1      0.4

                         8     3.4    3.4      0.0

 

 

Univariate Procedure

Variable=IMPROV

                                  Moments

 

                  N                 8  Sum Wgts          8

                  Mean            0.4  Sum             3.2

                  Std Dev    0.583095  Variance       0.34

                  Skewness   0.881993  Kurtosis   0.391745

                  USS            3.66  CSS            2.38

                  CV         145.7738  Std Mean   0.206155

                  T:Mean=0   1.940285  Pr>|T|       0.0935

                  Num ^= 0          7  Num > 0           5

                  M(Sign)         1.5  Pr>=|M|      0.4531

                  Sgn Rank         10  Pr>=|S|      0.1250

 

For the t-test, the p-value of .0935 provides only marginal evidence that there is improvement between the two interfaces. The signed rank test (p-value = .125) does not provide enough evidence to conclude that there is improvement.