Sample SAS Programs



One-factor ANOVA  TO TOP 
  • This program reads data from within the program in free format.
options nocenter ls=80 ps=60; 
data a; 
input y group; 
16 1 
18 1 
10 1 
12 1 
19 1 
4 2 
6 2 
8 2 
10 2 
2 2 
2 3 
10 3 
9 3 
13 3 
11 3 

proc glm; 
class group; 
model y=group; 
run; 
quit; 

General Linear Models Procedure 
Class Level Information 

Class    Levels    Values 

GROUP         3    1 2 3 

Number of observations in data set = 15 

General Linear Models Procedure 

Dependent Variable: Y    
                                     Sum of            Mean 
Source                  DF          Squares          Square   F Value     Pr > F 

Model                    2     210.00000000    105.00000000      7.41     0.0080 

Error                   12     170.00000000     14.16666667 

Corrected Total         14     380.00000000 

                  R-Square             C.V.        Root MSE               Y Mean 

                  0.552632         37.63863       3.7638633            10.000000 

Source                  DF        Type I SS     Mean Square   F Value     Pr > F 

GROUP                    2     210.00000000    105.00000000      7.41     0.0080 

Source                  DF      Type III SS     Mean Square   F Value     Pr > F 

GROUP                    2     210.00000000    105.00000000      7.41     0.0080 



One-factor ANOVA with contrasts TO TOP 
  • This program reads data from the file 'kep1.dat' in fixed format.
  • You can run as many contrasts as you want in SAS.
options nocenter ls=80 ps=60; 
title 'one factor with contrasts'; 
data a; infile 'kep1.dat'; 
input y 1-2 group 4; 
proc glm; 
class group; 
model y=group; 
contrast 'group1 vs group2' group 1 -1 0; 
contrast 'group2 vs group3' group 0 1 -1; 
contrast 'group1+2 vs group3' group -1 -1 2; 
run; 
quit; 

General Linear Models Procedure 
Class Level Information 

Class    Levels    Values 

GROUP         3    1 2 3 

Number of observations in data set = 15 

one factor with contrasts                    14:24 Thursday, August 27, 1998   2 

General Linear Models Procedure 

Dependent Variable: Y    
                                     Sum of            Mean 
Source                  DF          Squares          Square   F Value     Pr > F 

Model                    2     210.00000000    105.00000000      7.41     0.0080 

Error                   12     170.00000000     14.16666667 

Corrected Total         14     380.00000000 

                  R-Square             C.V.        Root MSE               Y Mean 

                  0.552632         37.63863       3.7638633            10.000000 

Source                  DF        Type I SS     Mean Square   F Value     Pr > F 

GROUP                    2     210.00000000    105.00000000      7.41     0.0080 

Source                  DF      Type III SS     Mean Square   F Value     Pr > F 

GROUP                    2     210.00000000    105.00000000      7.41     0.0080 

Contrast                DF      Contrast SS     Mean Square   F Value     Pr > F 

group1 vs group2         1     202.50000000    202.50000000     14.29     0.0026 
group2 vs group3         1      22.50000000     22.50000000      1.59     0.2315 
group1+2 vs group3       1       7.50000000      7.50000000      0.53     0.4808 


One-factor ANOVA with correction for alpha inflation TO TOP 

  • This program reads data from the file 'kep1.dat' in fixed format.
  • Note that the Dunnett correction assumes the control group is coded as "1". In this example the control group is "3" so the program specifies this fact.
options nocenter ls=80 ps=60; 
title 'Corrections for experimentwise error'; 
data a; 
infile 'kep1.dat'; 
input y 1-2 group 4; 
proc glm; 
class group; 
model y=group; 
means group/scheffe; 
means group/tukey; 
means group/dunnett ("3"); 
means group/lsd; 
run; 
quit; 

Corrections for experimentwise error     10:18 Wednesday, September 30, 1998   2 

General Linear Models Procedure 

Dependent Variable: Y  
                                     Sum of            Mean 
Source                  DF          Squares          Square   F Value     Pr > F 

Model                    2     210.00000000    105.00000000      7.41     0.0080 

Error                   12     170.00000000     14.16666667 

Corrected Total         14     380.00000000 

                  R-Square             C.V.        Root MSE               Y Mean 

                  0.552632         37.63863       3.7638633            10.000000 
 

Source                  DF        Type I SS     Mean Square   F Value     Pr > F 

GROUP                    2     210.00000000    105.00000000      7.41     0.0080 

Source                  DF      Type III SS     Mean Square   F Value     Pr > F 

GROUP                    2     210.00000000    105.00000000      7.41     0.0080 
 
 

Corrections for experimentwise error     10:18 Wednesday, September 30, 1998   3 

General Linear Models Procedure 

Scheffe's test for variable: Y 

NOTE: This test controls the type I experimentwise error rate but generally has a higher type II error rate than REGWF for all pairwise comparisons 

Alpha= 0.05  df= 12  MSE= 14.16667 
Critical Value of F= 3.88529 
Minimum Significant Difference= 6.6358 

Means with the same letter are not significantly different. 

Scheffe Grouping              Mean      N  GROUP 
  
                A            15.000      5  1 
                A  
        B       A             9.000      5  3 
        B  
        B                     6.000      5  2 
 
 

Corrections for experimentwise error     10:18 Wednesday, September 30, 1998   4 

General Linear Models Procedure 

Tukey's Studentized Range (HSD) Test for variable: Y 

NOTE: This test controls the type I experimentwise error rate, but generally has a higher type II error rate than REGWQ. 

Alpha= 0.05  df= 12  MSE= 14.16667 
Critical Value of Studentized Range= 3.773 
Minimum Significant Difference= 6.3505 

Means with the same letter are not significantly different. 

Tukey Grouping              Mean      N  GROUP 
  
                  A            15.000      5  1 
                  A  
          B       A             9.000      5  3 
          B  
          B                     6.000      5  2 
 
 

Corrections for experimentwise error     10:18 Wednesday, September 30, 1998   5 

General Linear Models Procedure 

Dunnett's T tests for variable: Y 

NOTE: This tests controls the type I experimentwise error for comparisons of  
      all treatments against a control. 

Alpha= 0.05  Confidence= 0.95  df= 12  MSE= 14.16667 
Critical Value of Dunnett's T= 2.502 
Minimum Significant Difference= 5.9569 

Comparisons significant at the 0.05 level are indicated by '***'. 

               Simultaneous            Simultaneous 
                   Lower    Difference     Upper 
   GROUP        Confidence    Between   Confidence 
 Comparison        Limit       Means       Limit 

1    - 3           0.043       6.000      11.957   *** 
2    - 3          -8.957      -3.000       2.957 
 
 

Corrections for experimentwise error     10:18 Wednesday, September 30, 1998   6 

General Linear Models Procedure 

T tests (LSD) for variable: Y 

NOTE: This test controls the type I comparisonwise error rate not the  
      experimentwise error rate. 

Alpha= 0.05  df= 12  MSE= 14.16667 
Critical Value of T= 2.18 
Least Significant Difference= 5.1866 

Means with the same letter are not significantly different. 

T Grouping              Mean      N  GROUP 
  
                      A            15.000      5  1 
  
                      B             9.000      5  3 
                      B  
                      B             6.000      5  2 


Two-factor ANOVA TO TOP 

  • This program reads the data from the program in fixed format.
  • This program also asks for cell means to be printed.
options nocenter ls=80 ps=60; 
title 'Two factor ANOVA'; 
data a; 
input facta 1 factb 3 y 5-6; 
cards; 
1 1 1 
1 1 4 
1 1 0 
1 1 7 
2 1 13 
2 1 5 
2 1 7 
2 1 15 
3 1 9 
3 1 16 
3 1 18 
3 1 13 
1 2 15 
1 2 6 
1 2 10 
1 2 13 
2 2 6 
2 2 18 
2 2 9 
2 2 15 
3 2 14 
3 2 7 
3 2 6 
3 2 13 

proc glm; 
class facta factb; 
model y=facta factb facta*factb; 
means facta*factb; 
run; 
quit; 

Two factor ANOVA                               11:28 Monday, October 5, 1998   2 

General Linear Models Procedure 

Dependent Variable: Y  
                                     Sum of            Mean 
Source                  DF          Squares          Square   F Value     Pr > F 

Model                    5     280.00000000     56.00000000      3.05     0.0361 

Error                   18     330.00000000     18.33333333 

Corrected Total         23     610.00000000 

                  R-Square             C.V.        Root MSE               Y Mean 

                  0.459016         42.81744       4.2817442            10.000000 
 

Source                  DF        Type I SS     Mean Square   F Value     Pr > F 

FACTA                    2     112.00000000     56.00000000      3.05     0.0721 
FACTB                    1      24.00000000     24.00000000      1.31     0.2675 
FACTA*FACTB              2     144.00000000     72.00000000      3.93     0.0384 

Source                  DF      Type III SS     Mean Square   F Value     Pr > F 

FACTA                    2     112.00000000     56.00000000      3.05     0.0721 
FACTB                    1      24.00000000     24.00000000      1.31     0.2675 
FACTA*FACTB              2     144.00000000     72.00000000      3.93     0.0384 

Two factor ANOVA                               11:28 Monday, October 5, 1998   3 

General Linear Models Procedure 

Level of   Level of       --------------Y-------------- 
FACTA      FACTB      N       Mean              SD 

1          1          4      3.0000000       3.16227766 
1          2          4     11.0000000       3.91578004 
2          1          4     10.0000000       4.76095229 
2          2          4     12.0000000       5.47722558 
3          1          4     14.0000000       3.91578004 
3          2          4     10.0000000       4.08248290 


Three-factor ANOVA TO TOP 

  • This program reads the data from the program in free format.
  • Note that all effects are listed, including three 2-way interactions and one 3-way interaction.
options nocenter ls=80 ps=60; 
title 'Three factor between subjects design'; 
data a; 
input facta factb factc y; 
cards; 
1 1 1 7 
1 1 1 4 
1 1 1 5 
1 1 1 6 
1 1 2 7 
1 1 2 5 
1 1 2 5 
1 1 2 6 
1 2 1 2 
1 2 1 4 
1 2 1 3 
1 2 1 3 
1 2 2 2 
1 2 2 3 
1 2 2 4 
1 2 2 1 
1 3 1 4 
1 3 1 3 
1 3 1 0 
1 3 1 3 
1 3 2 1 
1 3 2 3 
1 3 2 2 
1 3 2 2 
2 1 1 10 
2 1 1 7 
2 1 1 6 
2 1 1 8 
2 1 2 6 
2 1 2 5 
2 1 2 5 
2 1 2 6 
2 2 1 4 
2 2 1 6 
2 2 1 3 
2 2 1 5 
2 2 2 1 
2 2 2 3 
2 2 2 4 
2 2 2 5 
2 3 1 7 
2 3 1 4 
2 3 1 5 
2 3 1 5 
2 3 2 1 
2 3 2 3 
2 3 2 3 
2 3 2 0 
3 1 1 13 
3 1 1 10 
3 1 1 13 
3 1 1 8 
3 1 2 12 
3 1 2 13 
3 1 2 11 
3 1 2 12 
3 2 1 9 
3 2 1 8 
3 2 1 9 
3 2 1 10 
3 2 2 7 
3 2 2 6 
3 2 2 7 
3 2 2 6 
3 3 1 8 
3 3 1 5 
3 3 1 6 
3 3 1 6 
3 3 2 7 
3 3 2 7 
3 3 2 4 
3 3 2 6 

proc glm; 
class facta factb factc; 
model y=facta factb factc facta*factb facta*factc factb*factc facta*factb*factc; 
means facta*factb*factc; 
run; 
quit; 

Three factor between subjects design          18:34 Sunday, October 11, 1998   4 
General Linear Models Procedure 
Class Level Information 
Class    Levels    Values 

FACTA         3    1 2 3 

FACTB         3    1 2 3 

FACTC         2    1 2 
Number of observations in data set = 72 

Three factor between subjects design          18:34 Sunday, October 11, 1998   5 
General Linear Models Procedure 

Dependent Variable: Y 
                                     Sum of            Mean 
Source                  DF          Squares          Square   F Value     Pr > F 

Model                   17     593.27777778     34.89869281     19.94     0.0001 

Error                   54      94.50000000      1.75000000 

Corrected Total         71     687.77777778 

                  R-Square             C.V.        Root MSE               Y Mean 

                  0.862601         23.81176       1.3228757            5.5555556 
 

Source                  DF        Type I SS     Mean Square   F Value     Pr > F 

FACTA                    2     318.52777778    159.26388889     91.01     0.0001 
FACTB                    2     209.02777778    104.51388889     59.72     0.0001 
FACTC                    1      20.05555556     20.05555556     11.46     0.0013 
FACTA*FACTB              4      12.22222222      3.05555556      1.75     0.1534 
FACTA*FACTC              2      15.02777778      7.51388889      4.29     0.0186 
FACTB*FACTC              2       4.69444444      2.34722222      1.34     0.2701 
FACTA*FACTB*FACTC        4      13.72222222      3.43055556      1.96     0.1137 

Source                  DF      Type III SS     Mean Square   F Value     Pr > F 

FACTA                    2     318.52777778    159.26388889     91.01     0.0001 
FACTB                    2     209.02777778    104.51388889     59.72     0.0001 
FACTC                    1      20.05555556     20.05555556     11.46     0.0013 
FACTA*FACTB              4      12.22222222      3.05555556      1.75     0.1534 
FACTA*FACTC              2      15.02777778      7.51388889      4.29     0.0186 
FACTB*FACTC              2       4.69444444      2.34722222      1.34     0.2701 
FACTA*FACTB*FACTC        4      13.72222222      3.43055556      1.96     0.1137 

Three factor between subjects design          18:34 Sunday, October 11, 1998   6 
General Linear Models Procedure 

Level of   Level of   Level of       --------------Y-------------- 
FACTA      FACTB      FACTC      N       Mean              SD 

1          1          1          4      5.5000000       1.29099445 
1          1          2          4      5.7500000       0.95742711 
1          2          1          4      3.0000000       0.81649658 
1          2          2          4      2.5000000       1.29099445 
1          3          1          4      2.5000000       1.73205081 
1          3          2          4      2.0000000       0.81649658 
2          1          1          4      7.7500000       1.70782513 
2          1          2          4      5.5000000       0.57735027 
2          2          1          4      4.5000000       1.29099445 
2          2          2          4      3.2500000       1.70782513 
2          3          1          4      5.2500000       1.25830574 
2          3          2          4      1.7500000       1.50000000 
3          1          1          4     11.0000000       2.44948974 
3          1          2          4     12.0000000       0.81649658 
3          2          1          4      9.0000000       0.81649658 
3          2          2          4      6.5000000       0.57735027 
3          3          1          4      6.2500000       1.25830574 
3          3          2          4      6.0000000       1.41421356 


Four-factor ANOVA TO TOP 

  • The data are read in from the program in fixed format.
  • Note that the pipe character ( | ) is used to request all possible interactions.
options nocenter ls=80 ps=60; 
data a; 
input facta 1 factb 2 factc 3 factd 4 y 5; 
cards; 
11113 
11112 
11127 
11125 
11212 
11211 
11226 
11225 
12119 
12118 
12123 
12123 
12217 
12214 
12228 
12226 
21111 
21112 
21124 
21124 
21217 
21213 
21222 
21221 
22116 
22115 
22129 
22127 
22215 
22214 
22223 
22226 

proc glm; 
class facta factb factc factd; 
model y=facta|factb|factc|factd; 
run; 
quit; 

The SAS System                                10:36 Monday, October 12, 1998   2 

General Linear Models Procedure 

Dependent Variable: Y 
                                     Sum of            Mean 
Source                  DF          Squares          Square   F Value     Pr > F 

Model                   15     146.50000000      9.76666667      5.79     0.0006 

Error                   16      27.00000000      1.68750000 

Corrected Total         31     173.50000000 

                  R-Square             C.V.        Root MSE               Y Mean 

                  0.844380         28.08731       1.2990381            4.6250000 
 

Source                  DF        Type I SS     Mean Square   F Value     Pr > F 

FACTA                    1       3.12500000      3.12500000      1.85     0.1924 
FACTB                    1      45.12500000     45.12500000     26.74     0.0001 
FACTA*FACTB              1       0.50000000      0.50000000      0.30     0.5937 
FACTC                    1       2.00000000      2.00000000      1.19     0.2924 
FACTA*FACTC              1       1.12500000      1.12500000      0.67     0.4262 
FACTB*FACTC              1       1.12500000      1.12500000      0.67     0.4262 
FACTA*FACTB*FACTC        1       8.00000000      8.00000000      4.74     0.0448 
FACTD                    1       3.12500000      3.12500000      1.85     0.1924 
FACTA*FACTD              1       0.50000000      0.50000000      0.30     0.5937 
FACTB*FACTD              1       8.00000000      8.00000000      4.74     0.0448 
FACTA*FACTB*FACTD        1      28.12500000     28.12500000     16.67     0.0009 
FACTC*FACTD              1       0.12500000      0.12500000      0.07     0.7890 
FACTA*FACTC*FACTD        1      32.00000000     32.00000000     18.96     0.0005 
FACTB*FACTC*FACTD        1      12.50000000     12.50000000      7.41     0.0151 
FACT*FACT*FACT*FACTD     1       1.12500000      1.12500000      0.67     0.4262 

Source                  DF      Type III SS     Mean Square   F Value     Pr > F 

FACTA                    1       3.12500000      3.12500000      1.85     0.1924 
FACTB                    1      45.12500000     45.12500000     26.74     0.0001 
FACTA*FACTB              1       0.50000000      0.50000000      0.30     0.5937 
FACTC                    1       2.00000000      2.00000000      1.19     0.2924 
FACTA*FACTC              1       1.12500000      1.12500000      0.67     0.4262 
FACTB*FACTC              1       1.12500000      1.12500000      0.67     0.4262 
FACTA*FACTB*FACTC        1       8.00000000      8.00000000      4.74     0.0448 
FACTD                    1       3.12500000      3.12500000      1.85     0.1924 
FACTA*FACTD              1       0.50000000      0.50000000      0.30     0.5937 
FACTB*FACTD              1       8.00000000      8.00000000      4.74     0.0448 
FACTA*FACTB*FACTD        1      28.12500000     28.12500000     16.67     0.0009 
FACTC*FACTD              1       0.12500000      0.12500000      0.07     0.7890 
FACTA*FACTC*FACTD        1      32.00000000     32.00000000     18.96     0.0005 
FACTB*FACTC*FACTD        1      12.50000000     12.50000000      7.41     0.0151 
FACT*FACT*FACT*FACTD     1       1.12500000      1.12500000      0.67     0.4262 



One-factor within ANOVA 

options nocenter ls=80 ps=60; 
title 'Repeated measures with contrasts, ch16'; 
data a; 
input score1 1-2 score2 3-4 score3 5-6; 
cards; 
081209 
081314 
091506 
001812 
131518 
101707 

proc glm; 
model score1 score2 score3= /nouni; 
repeated score 3; 
repeated score 3 polynomial/summary; 
repeated score 3 mean/summary printm; 
run; 
quit; 

Repeated measures with contrasts, ch16     13:47 Wednesday, November 4, 1998   1 

General Linear Models Procedure 

Number of observations in data set = 6 
  

Repeated measures with contrasts, ch16     13:47 Wednesday, November 4, 1998   2 

General Linear Models Procedure 
Repeated Measures Analysis of Variance 
Repeated Measures Level Information 

Dependent Variable     SCORE1   SCORE2   SCORE3 

    Level of SCORE          1        2        3 
 
  

Manova Test Criteria and Exact F Statistics for  
the Hypothesis of no SCORE Effect 
H = Type III SS&CP Matrix for SCORE   E = Error SS&CP Matrix 

S=1    M=0    N=1 

Statistic                     Value          F      Num DF    Den DF  Pr > F 

Wilks' Lambda              0.34386529     3.8162         2         4  0.1182 
Pillai's Trace             0.65613471     3.8162         2         4  0.1182 
Hotelling-Lawley Trace     1.90811554     3.8162         2         4  0.1182 
Roy's Greatest Root        1.90811554     3.8162         2         4  0.1182 
Repeated measures with contrasts, ch16     13:47 Wednesday, November 4, 1998   3 

General Linear Models Procedure 
Repeated Measures Analysis of Variance 
Univariate Tests of Hypotheses for Within Subject Effects 

Source: SCORE 
                                                                   Adj  Pr > F 
     DF       Type III SS       Mean Square   F Value   Pr > F    G - G    H - F 
      2      148.00000000       74.00000000      4.72   0.0360   0.0367   0.0360 

Source: Error(SCORE) 

     DF       Type III SS       Mean Square 
     10      156.66666667       15.66666667 

Greenhouse-Geisser Epsilon = 0.9875 
       Huynh-Feldt Epsilon = 1.6280 
  

Repeated measures with contrasts, ch16     13:47 Wednesday, November 4, 1998   4 

General Linear Models Procedure 
Repeated Measures Analysis of Variance 
Repeated Measures Level Information 

Dependent Variable     SCORE1   SCORE2   SCORE3 

    Level of SCORE          1        2        3 
 
  

Manova Test Criteria and Exact F Statistics for  
the Hypothesis of no SCORE Effect 
H = Type III SS&CP Matrix for SCORE   E = Error SS&CP Matrix 

S=1    M=0    N=1 

Statistic                     Value          F      Num DF    Den DF  Pr > F 

Wilks' Lambda              0.34386529     3.8162         2         4  0.1182 
Pillai's Trace             0.65613471     3.8162         2         4  0.1182 
Hotelling-Lawley Trace     1.90811554     3.8162         2         4  0.1182 
Roy's Greatest Root        1.90811554     3.8162         2         4  0.1182 
Repeated measures with contrasts, ch16     13:47 Wednesday, November 4, 1998   5 

General Linear Models Procedure 
Repeated Measures Analysis of Variance 
Univariate Tests of Hypotheses for Within Subject Effects 

Source: SCORE 
                                                                   Adj  Pr > F 
     DF       Type III SS       Mean Square   F Value   Pr > F    G - G    H - F 
      2      148.00000000       74.00000000      4.72   0.0360   0.0367   0.0360 

Source: Error(SCORE) 

     DF       Type III SS       Mean Square 
     10      156.66666667       15.66666667 

Greenhouse-Geisser Epsilon = 0.9875 
       Huynh-Feldt Epsilon = 1.6280 

Repeated measures with contrasts, ch16     13:47 Wednesday, November 4, 1998   6 

General Linear Models Procedure 
Repeated Measures Analysis of Variance 
Analysis of Variance of Contrast Variables 

SCORE.N represents the nth degree polynomial contrast for SCORE 

Contrast Variable: SCORE.1              

Source                  DF      Type III SS     Mean Square   F Value     Pr > F 

MEAN                     1      27.00000000     27.00000000      1.59     0.2632 

Error                    5      85.00000000     17.00000000 

Contrast Variable: SCORE.2 

Source                  DF      Type III SS     Mean Square   F Value     Pr > F 

MEAN                     1     121.00000000    121.00000000      8.44     0.0336 

Error                    5      71.66666667     14.33333333 
 
  

Repeated measures with contrasts, ch16     13:47 Wednesday, November 4, 1998   7 

General Linear Models Procedure 
Repeated Measures Analysis of Variance 
Repeated Measures Level Information 

Dependent Variable     SCORE1   SCORE2   SCORE3 

    Level of SCORE          1        2        3 
  

SCORE.N represents the contrast between the  
nth level of SCORE and the mean of the other levels 
  

M Matrix Describing Transformed Variables 

                   SCORE1            SCORE2            SCORE3 

SCORE.1       1.000000000      -0.500000000      -0.500000000 
SCORE.2      -0.500000000       1.000000000      -0.500000000 
 
  

Manova Test Criteria and Exact F Statistics for  
the Hypothesis of no SCORE Effect 
H = Type III SS&CP Matrix for SCORE   E = Error SS&CP Matrix 

S=1    M=0    N=1 

Statistic                     Value          F      Num DF    Den DF  Pr > F 

Wilks' Lambda              0.34386529     3.8162         2         4  0.1182 
Pillai's Trace             0.65613471     3.8162         2         4  0.1182 
Hotelling-Lawley Trace     1.90811554     3.8162         2         4  0.1182 
Roy's Greatest Root        1.90811554     3.8162         2         4  0.1182 
Repeated measures with contrasts, ch16     13:47 Wednesday, November 4, 1998   8 

General Linear Models Procedure 
Repeated Measures Analysis of Variance 
Univariate Tests of Hypotheses for Within Subject Effects 

Source: SCORE 
                                                                   Adj  Pr > F 
     DF       Type III SS       Mean Square   F Value   Pr > F    G - G    H - F 
      2      148.00000000       74.00000000      4.72   0.0360   0.0367   0.0360 

Source: Error(SCORE) 

     DF       Type III SS       Mean Square 
     10      156.66666667       15.66666667 

Greenhouse-Geisser Epsilon = 0.9875 
       Huynh-Feldt Epsilon = 1.6280 

Repeated measures with contrasts, ch16     13:47 Wednesday, November 4, 1998   9 

General Linear Models Procedure 
Repeated Measures Analysis of Variance 
Analysis of Variance of Contrast Variables 

SCORE.N represents the contrast between the  
nth level of SCORE and the mean of the other levels 

Contrast Variable: SCORE.1              

Source                  DF      Type III SS     Mean Square   F Value     Pr > F 

MEAN                     1     150.00000000    150.00000000      5.77     0.0615 

Error                    5     130.00000000     26.00000000 

Contrast Variable: SCORE.2 

Source                  DF      Type III SS     Mean Square   F Value     Pr > F 

MEAN                     1     181.50000000    181.50000000      8.44     0.0336 

Error                    5     107.50000000     21.50000000 
  


Two-factor within ANOVA 

options nocenter ls=80 ps=60; 
title 'Two-factor repeated measures, ch 21'; 
data a; 
input a1b1 a1b2 a1b3 a1b4 a2b1 a2b2 a2b3 a2b4; 
cards; 
03 04 03 07 05 06 07 11 
06 08 09 12 10 12 15 18 
07 13 11 11 10 15 14 15 
00 03 06 06 05 07 09 11 

proc glm; 
model a1b1 a1b2 a1b3 a1b4 a2b1 a2b2 a2b3 a2b4= /nouni; 
repeated freq 2, trials 4 polynomial/summary printm printe; 
run; 
quit; 

Two-factor repeated measures, ch 21       11:15 Wednesday, November 18, 1998   1 

General Linear Models Procedure 

Number of observations in data set = 4 
  

Two-factor repeated measures, ch 21       11:15 Wednesday, November 18, 1998   2 

General Linear Models Procedure 
Repeated Measures Analysis of Variance 
Repeated Measures Level Information 

Dependent Variable       A1B1     A1B2     A1B3     A1B4     A2B1     A2B2 

     Level of FREQ          1        1        1        1        2        2 
   Level of TRIALS          1        2        3        4        1        2 

Dependent Variable       A2B3     A2B4 

     Level of FREQ          2        2 
   Level of TRIALS          3        4 
 
  

Manova Test Criteria and Exact F Statistics for the Hypothesis of no FREQ Effect 
H = Type III SS&CP Matrix for FREQ   E = Error SS&CP Matrix 

S=1    M=-0.5    N=0.5 

Statistic                     Value          F      Num DF    Den DF  Pr > F 

Wilks' Lambda              0.04785056    59.6952         1         3  0.0045 
Pillai's Trace             0.95214944    59.6952         1         3  0.0045 
Hotelling-Lawley Trace    19.89839572    59.6952         1         3  0.0045 
Roy's Greatest Root       19.89839572    59.6952         1         3  0.0045 

Manova Test Criteria and Exact F Statistics for  
the Hypothesis of no TRIALS Effect 
H = Type III SS&CP Matrix for TRIALS   E = Error SS&CP Matrix 

S=1    M=0.5    N=-0.5 

Statistic                     Value          F      Num DF    Den DF  Pr > F 

Wilks' Lambda              0.00768937    43.0166         3         1  0.1115 
Pillai's Trace             0.99231063    43.0166         3         1  0.1115 
Hotelling-Lawley Trace   129.04970414    43.0166         3         1  0.1115 
Roy's Greatest Root      129.04970414    43.0166         3         1  0.1115 

Manova Test Criteria and Exact F Statistics for  
the Hypothesis of no FREQ*TRIALS Effect 
H = Type III SS&CP Matrix for FREQ*TRIALS   E = Error SS&CP Matrix 

S=1    M=0.5    N=-0.5 

Statistic                     Value          F      Num DF    Den DF  Pr > F 

Wilks' Lambda              0.00000000      .             3         1  0.0001 
Pillai's Trace             1.00000000      .             3         1  0.0001 
Hotelling-Lawley Trace      .              .             3         1  0.0001 
Roy's Greatest Root         .              .             3         1  0.0001 
Two-factor repeated measures, ch 21       11:15 Wednesday, November 18, 1998   3 

General Linear Models Procedure 
Repeated Measures Analysis of Variance 
Univariate Tests of Hypotheses for Within Subject Effects 

Source: FREQ 
                                                                   Adj  Pr > F 
     DF       Type III SS       Mean Square   F Value   Pr > F    G - G    H - F 
      1      116.28125000      116.28125000     59.70   0.0045    .        .     

Source: Error(FREQ) 

     DF       Type III SS       Mean Square 
      3        5.84375000        1.94791667 

Source: TRIALS 
                                                                   Adj  Pr > F 
     DF       Type III SS       Mean Square   F Value   Pr > F    G - G    H - F 
      3      129.59375000       43.19791667     12.23   0.0016   0.0112   0.0016 

Source: Error(TRIALS) 

     DF       Type III SS       Mean Square 
      9       31.78125000        3.53125000 

Greenhouse-Geisser Epsilon = 0.5868 
       Huynh-Feldt Epsilon = 1.3555 
  

Source: FREQ*TRIALS 
                                                                   Adj  Pr > F 
     DF       Type III SS       Mean Square   F Value   Pr > F    G - G    H - F 
      3        3.34375000        1.11458333      3.31   0.0712   0.1633   0.1585 

Source: Error(FREQ*TRIALS) 

     DF       Type III SS       Mean Square 
      9        3.03125000        0.33680556 

Greenhouse-Geisser Epsilon = 0.3475 
       Huynh-Feldt Epsilon = 0.3696 
  


Two-factor mixed ANOVA 

options nocenter ls=80 ps=60; 
title 'one within, one between --ch17'; 
data a; 
input facta b1 b2 b3 b4; 
parta=facta; 
if parta=1 then parta=.; 
cards; 
1 13 14 17 20 
1 10 11 15 14 
1 13 19 18 21 
1 04 12 14 15 
2 05 10 17 21 
2 08 15 22 24 
2 14 16 23 23 
2 12 21 26 26 
3 13 24 28 30 
3 09 22 22 24 
3 14 22 28 28 
3 08 18 27 28 

proc glm; 
class facta; 
model b1 b2 b3 b4=facta /nouni; 
repeated factb 4; 
run; 
quit; 

one within, one between --ch17             21:46 Thursday, November 19, 1998   2  

General Linear Models Procedure 
Class Level Information 

Class    Levels    Values 

FACTA         3    1 2 3 
  

Number of observations in data set = 12 

one within, one between --ch17             21:46 Thursday, November 19, 1998   3 

General Linear Models Procedure 
Repeated Measures Analysis of Variance 
Repeated Measures Level Information 

Dependent Variable         B1       B2       B3       B4 

    Level of FACTB          1        2        3        4 
 
  

Manova Test Criteria and Exact F Statistics for  
the Hypothesis of no FACTB Effect 
H = Type III SS&CP Matrix for FACTB   E = Error SS&CP Matrix 

S=1    M=0.5    N=2.5 

Statistic                     Value          F      Num DF    Den DF  Pr > F 

Wilks' Lambda              0.03516178    64.0266         3         7  0.0001 
Pillai's Trace             0.96483822    64.0266         3         7  0.0001 
Hotelling-Lawley Trace    27.43997368    64.0266         3         7  0.0001 
Roy's Greatest Root       27.43997368    64.0266         3         7  0.0001 

Manova Test Criteria and F Approximations for  
the Hypothesis of no FACTB*FACTA Effect 
H = Type III SS&CP Matrix for FACTB*FACTA   E = Error SS&CP Matrix 

S=2    M=0    N=2.5 

Statistic                     Value          F      Num DF    Den DF  Pr > F 

Wilks' Lambda              0.17880173     3.1848         6        14  0.0347 
Pillai's Trace             1.03471392     2.8585         6        16  0.0435 
Hotelling-Lawley Trace     3.39863961     3.3986         6        12  0.0339 
Roy's Greatest Root        3.00068071     8.0018         3         8  0.0086 

NOTE: F Statistic for Roy's Greatest Root is an upper bound. 
NOTE: F Statistic for Wilks' Lambda is exact. 

one within, one between --ch17             21:46 Thursday, November 19, 1998   4 

General Linear Models Procedure 
Repeated Measures Analysis of Variance 
Tests of Hypotheses for Between Subjects Effects 

Source                  DF      Type III SS     Mean Square   F Value     Pr > F 

FACTA                    2      414.1250000     207.0625000      6.17     0.0206 

Error                    9      302.1250000      33.5694444 
 
  

one within, one between --ch17             21:46 Thursday, November 19, 1998   5 

General Linear Models Procedure 
Repeated Measures Analysis of Variance 
Univariate Tests of Hypotheses for Within Subject Effects 

Source: FACTB 
                                                                   Adj  Pr > F 
     DF       Type III SS       Mean Square   F Value   Pr > F    G - G    H - F 
      3     1152.41666667      384.13888889    114.76   0.0001   0.0001   0.0001 

Source: FACTB*FACTA 
                                                                   Adj  Pr > F 
     DF       Type III SS       Mean Square   F Value   Pr > F    G - G    H - F 
      6      130.20833333       21.70138889      6.48   0.0003   0.0007   0.0003 

Source: Error(FACTB) 

     DF       Type III SS       Mean Square 
     27       90.37500000        3.34722222 

Greenhouse-Geisser Epsilon = 0.8298 
       Huynh-Feldt Epsilon = 1.4270 
 



Back to the ANOVA HomePage