Sample SAS Programs
One-factor ANOVA TO TOP
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 Levels Values GROUP 3 1 2 3 Number of observations in data set = 15 General Linear Models Procedure Dependent Variable: Y
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
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 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
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
One-factor ANOVA with correction for alpha inflation TO TOP
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
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
Means with the same letter are not significantly different. Scheffe Grouping
Mean N GROUP
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
Means with the same letter are not significantly different. Tukey Grouping
Mean N GROUP
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
Alpha= 0.05 Confidence= 0.95 df= 12
MSE= 14.16667
Comparisons significant at the 0.05 level are indicated by '***'.
Simultaneous
Simultaneous
1 - 3
0.043 6.000
11.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
Alpha= 0.05 df= 12 MSE= 14.16667
Means with the same letter are not significantly different. T Grouping
Mean N GROUP
Two-factor ANOVA TO TOP
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
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
Source DF Type III SS Mean Square F Value Pr > F FACTA
2 112.00000000 56.00000000
3.05 0.0721
Two factor ANOVA 11:28 Monday, October 5, 1998 3 General Linear Models Procedure Level of Level of
--------------Y--------------
1
1 4
3.0000000 3.16227766
Three-factor ANOVA TO TOP
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
FACTA 3 1 2 3 FACTB 3 1 2 3 FACTC
2 1 2
Three factor between subjects design
18:34 Sunday, October 11, 1998 5
Dependent Variable: Y
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
Source DF Type III SS Mean Square F Value Pr > F FACTA
2 318.52777778 159.26388889
91.01 0.0001
Three factor between subjects design
18:34 Sunday, October 11, 1998 6
Level of Level of Level of
--------------Y--------------
1
1 1
4 5.5000000
1.29099445
Four-factor ANOVA TO TOP
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
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
Source DF Type III SS Mean Square F Value Pr > F FACTA
1 3.12500000
3.12500000 1.85 0.1924
One-factor within ANOVA options nocenter ls=80 ps=60;
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
Dependent Variable SCORE1 SCORE2 SCORE3 Level of SCORE
1 2
3
Manova Test Criteria and Exact F Statistics for
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
General Linear Models Procedure
Source: SCORE
Source: Error(SCORE) DF
Type III SS Mean Square
Greenhouse-Geisser Epsilon = 0.9875
Repeated measures with contrasts, ch16 13:47 Wednesday, November 4, 1998 4 General Linear Models Procedure
Dependent Variable SCORE1 SCORE2 SCORE3 Level of SCORE
1 2
3
Manova Test Criteria and Exact F Statistics for
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
General Linear Models Procedure
Source: SCORE
Source: Error(SCORE) DF
Type III SS Mean Square
Greenhouse-Geisser Epsilon = 0.9875
Repeated measures with contrasts, ch16 13:47 Wednesday, November 4, 1998 6 General Linear Models Procedure
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
Dependent Variable SCORE1 SCORE2 SCORE3 Level of SCORE
1 2
3
SCORE.N represents the contrast between the
M Matrix Describing Transformed Variables SCORE1 SCORE2 SCORE3 SCORE.1 1.000000000
-0.500000000 -0.500000000
Manova Test Criteria and Exact F Statistics for
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
General Linear Models Procedure
Source: SCORE
Source: Error(SCORE) DF
Type III SS Mean Square
Greenhouse-Geisser Epsilon = 0.9875
Repeated measures with contrasts, ch16 13:47 Wednesday, November 4, 1998 9 General Linear Models Procedure
SCORE.N represents the contrast between the
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
options nocenter ls=80 ps=60;
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
Dependent Variable A1B1 A1B2 A1B3 A1B4 A2B1 A2B2 Level of FREQ
1 1
1 1
2 2
Dependent Variable A2B3 A2B4 Level of FREQ
2 2
Manova Test Criteria and Exact F Statistics for the
Hypothesis of no FREQ Effect
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
Manova Test Criteria and Exact F Statistics for
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
Manova Test Criteria and Exact F Statistics for
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
General Linear Models Procedure
Source: FREQ
Source: Error(FREQ) DF
Type III SS Mean Square
Source: TRIALS
Source: Error(TRIALS) DF
Type III SS Mean Square
Greenhouse-Geisser Epsilon = 0.5868
Source: FREQ*TRIALS
Source: Error(FREQ*TRIALS) DF
Type III SS Mean Square
Greenhouse-Geisser Epsilon = 0.3475
options nocenter ls=80 ps=60;
one within, one between --ch17 21:46 Thursday, November 19, 1998 2 General Linear Models Procedure
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
Dependent Variable B1 B2 B3 B4 Level of FACTB
1 2
3 4
Manova Test Criteria and Exact F Statistics for
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
Manova Test Criteria and F Approximations for
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
NOTE: F Statistic for Roy's Greatest Root is an upper
bound.
one within, one between --ch17 21:46 Thursday, November 19, 1998 4 General Linear Models Procedure
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
Source: FACTB
Source: FACTB*FACTA
Source: Error(FACTB) DF
Type III SS Mean Square
Greenhouse-Geisser Epsilon = 0.8298
Back to the ANOVA HomePage |