Original Program from program editor.

****************************************************;
*** Steele & Torrie (1980) Table 5.2             ***; 
*** Percent digestability of corn silage was     ***;
***  examined for sheep and steers.              ***;
***                                              ***;
****************************************************;
options ps=61 ls=64 nocenter nodate nonumber;
TITLE1 'Two sample t-tests';


data silage; infile cards missover;
     TITLE2 'Percent digestability of corn silage';
     LABEL animal = 'Type of animal tested';
     LABEL percent = 'Percent digestability';
  input sheep steers;
   animal = 'Sheep '; percent = sheep; output; 
   animal = 'Steers'; percent = steers; output;
cards; run;
57.8   64.2
56.2   58.7
61.9   63.1
54.4   62.5
53.6   59.8
56.4   59.2
53.2
;
proc print data=silage; var animal percent; 
   TITLE3 'Raw data listing';
run;
proc ttest data=silage; class animal; var percent; 
   TITLE3 'PROC TTEST results';
run;



*****************************************************;
*** Steele & Torrie (1980) Table 5.6              ***;
*** Percent fine gravel found in surface soils.   ***;
***   Data from a study comparing characteristics ***;
***   of soil catagorized as "good" or "poor".    ***;
*****************************************************;
options ps=61 ls=78 nocenter nodate nonumber;
TITLE1 'Two sample t-tests';

data dirt; infile cards missover;
     TITLE2 'Percent fine gravel in surface soils';
     LABEL soilqual = 'Soil quality evaluation';
     LABEL percent = 'Percent fine gravel';
  input good poor;
   soilqual = 'good '; percent = good; output;
   soilqual = 'poor'; percent = poor; output;
cards; run;
 5.9   7.6
 3.8   0.4
 6.5   1.1
18.3   3.2
18.2   6.5
16.1   4.1
 7.6   4.7
;
proc print data=dirt; var soilqual percent; 
   TITLE3 'Raw data listing';
run;
proc ttest data=dirt; class soilqual; var percent; 
   TITLE3 'PROC TTEST results';
run;




*******************************************************;
*** Steele & Torrie (1980) Exercise 5.5.6           ***;
*** The weights in grams of 10 male and 10 female   ***;
*** juvenile ring-necked pheasants trapped in       ***;
*** January in Wisconsin are given.  Test the Ho    ***;
*** that males were 350 grams heavier than females. ***;
*******************************************************;
options ps=61 ls=78 nocenter nodate nonumber;
TITLE1 'Two sample t-tests';

data birds; infile cards missover;
     TITLE2 'Weight in gms of male & female pheasants';
     LABEL sex = 'Sex of pheasant';
     LABEL weight = 'Weight in grams';
  input sex $ weight;
     if sex eq 'Male' then AdjWT = Weight - 350;
     else AdjWT = weight;
cards; run;
Female    1061
Female    1065
Female    1092
Female    1017
Female    1021
Female    1138
Female    1143
Female    1094
Female    1270
Female    1028
Male      1293
Male      1380
Male      1614
Male      1497
Male      1340
Male      1643
Male      1466
Male      1627
Male      1383
Male      1711
;
proc print data=birds; var sex weight adjwt; 
   TITLE3 'Raw data listing';
run;

proc ttest data=birds H0=-350; class sex; var weight; 
   TITLE3 'PROC TTEST results specifying a difference';
run;
proc ttest data=birds; class sex; var adjwt; 
   TITLE3 'PROC TTEST results on adjusted values';
run;



Below is output from the SAS log (bold) and output from the SAS Output window.



1          ****************************************************;
2          *** Steele & Torrie (1980) Table 5.2             ***;
3          *** Percent digestability of corn silage was     ***;
4          ***  examined for sheep and steers.              ***;
5          ***                                              ***;
6          ****************************************************;
7          options ps=61 ls=64 nocenter nodate nonumber;
8          TITLE1 'Two sample t-tests';
9
10
11         data silage; infile cards missover;
12              TITLE2 'Percent digestability of corn silage';
13              LABEL animal = 'Type of animal tested';
14              LABEL percent = 'Percent digestability';
15           input sheep steers;
16            animal = 'Sheep '; percent = sheep; output;
17            animal = 'Steers'; percent = steers; output;
18         cards;
NOTE: The data set WORK.SILAGE has 14 observations and 4
      variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds
18       !        run;
26         ;
27         proc print data=silage; var animal percent;
28            TITLE3 'Raw data listing';
29         run;
NOTE: There were 14 observations read from the data set
      WORK.SILAGE.
NOTE: The PROCEDURE PRINT printed page 1.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


Two sample t-tests
Percent digestability of corn silage
Raw data listing

Obs    animal    percent
  1    Sheep       57.8
  2    Steers      64.2
  3    Sheep       56.2
  4    Steers      58.7
  5    Sheep       61.9
  6    Steers      63.1
  7    Sheep       54.4
  8    Steers      62.5
  9    Sheep       53.6
 10    Steers      59.8
 11    Sheep       56.4
 12    Steers      59.2
 13    Sheep       53.2
 14    Steers        .




30         proc ttest data=silage; class animal; var percent;
31            TITLE3 'PROC TTEST results';
32         run;
NOTE: There were 14 observations read from the data set
      WORK.SILAGE.
NOTE: The PROCEDURE TTEST printed page 2.
NOTE: PROCEDURE TTEST used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds



Two sample t-tests
Percent digestability of corn silage
PROC TTEST results

The TTEST Procedure

Statistics
                                Lower CL            Upper CL
Variable   animal           N       Mean     Mean       Mean
percent    Sheep            7     53.437   56.214     58.991
percent    Steers           6     58.834    61.25     63.666
percent    Diff (1-2)              -8.35   -5.036     -1.721

Statistics
                        Lower CL             Upper CL
Variable   animal        Std Dev   Std Dev    Std Dev   Std Err
percent    Sheep          1.9348    3.0025     6.6116    1.1348
percent    Steers         1.4369     2.302     5.6458    0.9398
percent    Diff (1-2)     1.9174    2.7066     4.5955    1.5058

Statistics
Variable   animal       Minimum    Maximum
percent    Sheep           53.2       61.9
percent    Steers          58.7       64.2
percent    Diff (1-2)

T-Tests
Variable   Method          Variances     DF   t Value   Pr > |t|
percent    Pooled          Equal         11     -3.34     0.0065
percent    Satterthwaite   Unequal     10.9     -3.42     0.0058

Equality of Variances
Variable    Method      Num DF    Den DF    F Value    Pr > F
percent     Folded F         6         5       1.70    0.5764




36         ***************************************************** ;
37         *** Steele & Torrie (1980) Table 5.6              *** ;
38         *** Percent fine gravel found in surface soils.   *** ;
39         ***   Data from a study comparing characteristics *** ;
40         ***   of soil catagorized as "good" or "poor".    *** ;
41         ***************************************************** ;
42         options ps=61 ls=78 nocenter nodate nonumber;
43         TITLE1 'Two sample t-tests';
44
45         data dirt; infile cards missover;
46              TITLE2 'Percent fine gravel in surface soils';
47              LABEL soilqual = 'Soil quality evaluation';
48              LABEL percent = 'Percent fine gravel';
49           input good poor;
50            soilqual = 'good '; percent = good; output;
51            soilqual = 'poor'; percent = poor; output;
52         cards;
NOTE: The data set WORK.DIRT has 14 observations and 4 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
52       !        run;
60         ;
61         proc print data=dirt; var soilqual percent;
62            TITLE3 'Raw data listing';
63         run;
NOTE: There were 14 observations read from the data set WORK.DIRT.
NOTE: The PROCEDURE PRINT printed page 3.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds



Two sample t-tests
Percent fine gravel in surface soils
Raw data listing

Obs    soilqual    percent
  1      good         5.9
  2      poor         7.6
  3      good         3.8
  4      poor         0.4
  5      good         6.5
  6      poor         1.1
  7      good        18.3
  8      poor         3.2
  9      good        18.2
 10      poor         6.5
 11      good        16.1
 12      poor         4.1
 13      good         7.6
 14      poor         4.7



64         proc ttest data=dirt; class soilqual; var percent; 
65            TITLE3 'PROC TTEST results';
66         run;
NOTE: There were 14 observations read from the data set WORK.DIRT.
NOTE: The PROCEDURE TTEST printed page 4.
NOTE: PROCEDURE TTEST used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds



Two sample t-tests
Percent fine gravel in surface soils
PROC TTEST results 

The TTEST Procedure

Statistics
                             Lower CL          Upper CL  Lower CL
Variable  soilqual        N      Mean    Mean      Mean   Std Dev  Std Dev
percent   good            7    5.0559  10.914    16.773    4.0819   6.3344
percent   poor            7    1.5048  3.9429    6.3809    1.6987   2.6362
percent   Diff (1-2)           1.3212  6.9714    12.622    3.4789   4.8515

Statistics
                      Upper CL
Variable  soilqual     Std Dev    Std Err    Minimum    Maximum
percent   good          13.949     2.3942        3.8       18.3
percent   poor          5.8051     0.9964        0.4        7.6
percent   Diff (1-2)    8.0086     2.5932

T-Tests
Variable    Method           Variances      DF    t Value    Pr > |t|
percent     Pooled           Equal          12       2.69      0.0197
percent     Satterthwaite    Unequal      8.02       2.69      0.0275

Equality of Variances
Variable    Method      Num DF    Den DF    F Value    Pr > F
percent     Folded F         6         6       5.77    0.0509







71         *******************************************************;
72         *** Steele & Torrie (1980) Exercise 5.5.6           ***;
73         *** The weights in grams of 10 male and 10 female   ***;
74         *** juvenile ring-necked pheasants trapped in       ***;
75         *** January in Wisconsin are given.  Test the Ho    ***;
76         *** that males were 350 grams heavier than females. ***;
77         *******************************************************;
78         options ps=61 ls=78 nocenter nodate nonumber;
79         TITLE1 'Two sample t-tests';
80
81         data birds; infile cards missover;
82              TITLE2 'Weight in gms of male & female pheasants';
83              LABEL sex = 'Sex of pheasant';
84              LABEL weight = 'Weight in grams';
85           input sex $ weight;
86              if sex eq 'Male' then AdjWT = Weight - 350;
87              else AdjWT = weight;
88         cards;

NOTE: The data set WORK.BIRDS has 20 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds

88       !        run;
109        ;
110        proc print data=birds; var sex weight adjwt;
111           TITLE3 'Raw data listing';
112        run;
NOTE: There were 20 observations read from the data set WORK.BIRDS.
NOTE: The PROCEDURE PRINT printed page 5.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds



Two sample t-tests
Weight in gms of male & female pheasants
Raw data listing

                            Adj
Obs     sex      weight     WT
  1    Female     1061     1061
  2    Female     1065     1065
  3    Female     1092     1092
  4    Female     1017     1017
  5    Female     1021     1021
  6    Female     1138     1138
  7    Female     1143     1143
  8    Female     1094     1094
  9    Female     1270     1270
 10    Female     1028     1028
 11    Male       1293      943
 12    Male       1380     1030
 13    Male       1614     1264
 14    Male       1497     1147
 15    Male       1340      990
 16    Male       1643     1293
 17    Male       1466     1116
 18    Male       1627     1277
 19    Male       1383     1033
 20    Male       1711     1361





113
114        proc ttest data=birds H0=-350; class sex; var weight;
115           TITLE3 'PROC TTEST results specifying a difference';
116        run;
NOTE: There were 20 observations read from the data set WORK.BIRDS.
NOTE: The PROCEDURE TTEST printed page 6.
NOTE: PROCEDURE TTEST used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds



Two sample t-tests
Weight in gms of male & female pheasants
PROC TTEST results specifying a difference

The TTEST Procedure

Statistics
                             Lower CL          Upper CL  Lower CL
Variable  sex             N      Mean    Mean      Mean   Std Dev  Std Dev
weight    Female         10    1038.1  1092.9    1147.7    52.709    76.63
weight    Male           10      1391  1495.4    1599.8    100.36    145.9
weight    Diff (1-2)             -512  -402.5      -293    88.053   116.53

Statistics
                      Upper CL
Variable  sex          Std Dev    Std Err    Minimum    Maximum
weight    Female         139.9     24.232       1017       1270
weight    Male          266.36     46.138       1293       1711
weight    Diff (1-2)    172.33     52.115

T-Tests
Variable    Method           Variances      DF    t Value    Pr > |t|
weight      Pooled           Equal          18      -1.01      0.3271
weight      Satterthwaite    Unequal      13.6      -1.01      0.3313

Equality of Variances
Variable    Method      Num DF    Den DF    F Value    Pr > F
weight      Folded F         9         9       3.63    0.0686




117        proc ttest data=birds; class sex; var adjwt;
118           TITLE3 'PROC TTEST results on adjusted values';
119        run;
NOTE: There were 20 observations read from the data set WORK.BIRDS.
NOTE: The PROCEDURE TTEST printed page 7.
NOTE: PROCEDURE TTEST used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414
NOTE: The SAS System used:
      real time           0.59 seconds
      cpu time            0.24 seconds



Two sample t-tests
Weight in gms of male & female pheasants
PROC TTEST results on adjusted values

The TTEST Procedure

Statistics
                             Lower CL          Upper CL  Lower CL
Variable  sex             N      Mean    Mean      Mean   Std Dev  Std Dev
AdjWT     Female         10    1038.1  1092.9    1147.7    52.709    76.63
AdjWT     Male           10      1041  1145.4    1249.8    100.36    145.9
AdjWT     Diff (1-2)             -162   -52.5    56.989    88.053   116.53

Statistics
                      Upper CL
Variable  sex          Std Dev    Std Err    Minimum    Maximum
AdjWT     Female         139.9     24.232       1017       1270
AdjWT     Male          266.36     46.138        943       1361
AdjWT     Diff (1-2)    172.33     52.115

T-Tests
Variable    Method           Variances      DF    t Value    Pr > |t|
AdjWT       Pooled           Equal          18      -1.01      0.3271
AdjWT       Satterthwaite    Unequal      13.6      -1.01      0.3313

Equality of Variances
Variable    Method      Num DF    Den DF    F Value    Pr > F
AdjWT       Folded F         9         9       3.63    0.0686




Last modified
by James P. Geaghan
on Wednesday, August 13, 2003