/* tail part of attitude.sas */
data all;  merge urban rural; by area;
   person = 'Father'; t1 = ft1; t2 = ft2; t3 = ft3; output;
   person = 'Mother'; t1 = mt1; t2 = mt2; t3 = mt3; output;
   person = 'Son';    t1 = st1; t2 = st2; t3 = st3; output;
data times; set all;
   y = t1; time = 1; output;
   y = t2; time = 2; output;
   y = t3; time = 3; output;
proc glm; class area family person time;
   model y = area area*family person person*area person*area*family
      time time*person time*area time*person*area / ss1;
   test h = area e = area*family;
   test h = person person*area e = person*area*family;
data b; set all;
proc glm; class area family person;
   model t1 t2 t3 = area area*family person person*area;
   repeated time 3 (1 2 3) contrast / summary;
--------------------------------------------------------------------------------
/* ordinary split-split plot analysis */
Source                  DF        Type I SS     Mean Square   F Value     Pr > F
AREA                     1     378.35378151    378.35378151      6.98     0.0185
AREA*FAMILY             15     813.08412698     54.20560847    145.15     0.0001
--------------------------------------------------------------------------------
PERSON                   2     679.56862745    339.78431373     13.94     0.0001
AREA*PERSON              2      33.41232493     16.70616246      0.69     0.5117
AREA*FAMILY*PERSON      30     731.46349206     24.38211640     65.29     0.0001
--------------------------------------------------------------------------------
TIME                     2     189.29411765     94.64705882    253.45     0.0001
PERSON*TIME              4       1.25490196      0.31372549      0.84     0.5033
AREA*TIME                2      28.36302521     14.18151261     37.98     0.0001
AREA*PERSON*TIME         4       1.47843137      0.36960784      0.99     0.4174
--------------------------------------------------------------------------------
/* separate analysis by each time */
Dependent Variable: T1               Sum of            Mean
Source                  DF          Squares          Square   F Value     Pr > F
Model                   20     664.80056022     33.24002801      3.84     0.0005
Error                   30     259.55238095      8.65174603
Corrected Total         50     924.35294118
Source                  DF        Type I SS     Mean Square   F Value     Pr > F
AREA                     1     125.36722689    125.36722689     14.49     0.0006
AREA*FAMILY             15     308.31904762     20.55460317      2.38     0.0213
PERSON                   2     222.47058824    111.23529412     12.86     0.0001
AREA*PERSON              2       8.64369748      4.32184874      0.50     0.6118
Dependent Variable: T2               Sum of            Mean
Source                  DF          Squares          Square   F Value     Pr > F
Model                   20     518.70700280     25.93535014      3.08     0.0027
Error                   30     252.70476190      8.42349206
Corrected Total         50     771.41176471
Source                  DF        Type I SS     Mean Square   F Value     Pr > F
AREA                     1      55.96890756     55.96890756      6.64     0.0151
AREA*FAMILY             15     234.10952381     15.60730159      1.85     0.0735
PERSON                   2     213.29411765    106.64705882     12.66     0.0001
AREA*PERSON              2      15.33445378      7.66722689      0.91     0.4133
Dependent Variable: T3               Sum of            Mean
Source                  DF          Squares          Square   F Value     Pr > F
Model                   20     766.12829132     38.30641457      4.81     0.0001
Error                   30     238.69523810      7.95650794
Corrected Total         50    1004.82352941
Source                  DF        Type I SS     Mean Square   F Value     Pr > F
AREA                     1     225.38067227    225.38067227     28.33     0.0001
AREA*FAMILY             15     284.77619048     18.98507937      2.39     0.0208
PERSON                   2     245.05882353    122.52941176     15.40     0.0001
AREA*PERSON              2      10.91260504      5.45630252      0.69     0.5114
--------------------------------------------------------------------------------
/* multivariate analysis of variance */
Manova Test Criteria   H = SS&CP Matrix for Effect   E = Error SS&CP Matrix
Statistic                     Value          F       Num DF     Den DF   Pr > F
TIME             S=1 M=0 N=13.5
Wilks' Lambda              0.05268166   260.7381          2         29   0.0001
Pillai's Trace             0.94731834   260.7381          2         29   0.0001
Hotelling-Lawley Trace    17.98193939   260.7381          2         29   0.0001
Roy's Greatest Root       17.98193939   260.7381          2         29   0.0001
TIME*AREA        S=1 M=0 N=13.5
Wilks' Lambda              0.22287717    50.5583          2         29   0.0001
Pillai's Trace             0.77712283    50.5583          2         29   0.0001
Hotelling-Lawley Trace     3.48677631    50.5583          2         29   0.0001
Roy's Greatest Root        3.48677631    50.5583          2         29   0.0001
NOTE BELOW: Roy's Greatest Root F is upper bound.  Wilks' Lambda F is exact.
TIME*AREA*FAMILY S=2 M=6 N=13.5
Wilks' Lambda              0.32572523     1.4542         30         58   0.1104
Pillai's Trace             0.85391722     1.4901         30         60   0.0945
Hotelling-Lawley Trace     1.51855700     1.4173         30         56   0.1287
Roy's Greatest Root        0.91735614     1.8347         15         30   0.0767
TIME*PERSON      S=2 M=-0.5 N=13.5
Wilks' Lambda              0.87753496     0.9787          4         58   0.4263
Pillai's Trace             0.12604360     1.0089          4         60   0.4101
Hotelling-Lawley Trace     0.13547775     0.9483          4         56   0.4431
Roy's Greatest Root        0.09033481     1.3550          2         30   0.2733
TIME*AREA*PERSON S=2 M=-0.5 N=13.5
Wilks' Lambda              0.86732779     1.0696          4         58   0.3799
Pillai's Trace             0.13723599     1.1051          4         60   0.3625
Hotelling-Lawley Trace     0.14770473     1.0339          4         56   0.3979
Roy's Greatest Root        0.08771871     1.3158          2         30   0.2833
--------------------------------------------------------------------------------
              Tests of Hypotheses for Between Subjects Effects
Source                  DF      Type III SS     Mean Square   F Value     Pr > F
AREA                     1      378.3537815     378.3537815     15.52     0.0005
AREA*FAMILY             15      813.0841270      54.2056085      2.22     0.0305
PERSON                   2      677.4123249     338.7061625     13.89     0.0001
AREA*PERSON              2       33.4123249      16.7061625      0.69     0.5117
Error                   30      731.4634921      24.3821164
--------------------------------------------------------------------------------
           Univariate Tests of Hypotheses for Within Subject Effects     Adj  Pr >
Source           DF   Type III SS   Mean Square  F Value   Pr > F    G - G    H - F
TIME              2  201.39236465  100.69618233   310.01   0.0001   0.0001   0.0001
TIME*AREA         2   28.36302521   14.18151261    43.66   0.0001   0.0001   0.0001
TIME*AREA*FAMILY 30   14.12063492    0.47068783     1.45   0.1107   0.1163   0.1107
TIME*PERSON       4    1.24313725    0.31078431     0.96   0.4379   0.4351   0.4379
TIME*AREA*PERSON  4    1.47843137    0.36960784     1.14   0.3474   0.3470   0.3474
Error(TIME)      60   19.48888889    0.32481481
Greenhouse-Geisser Epsilon = 0.9506   Huynh-Feldt Epsilon = 1.6898
--------------------------------------------------------------------------------
Analysis of Variance of Contrast Variables TIME.N = mean(t=N) - mean(t=last)
Source for TIME.1       DF      Type III SS     Mean Square   F Value     Pr > F
MEAN                     1     371.42389039    371.42389039    466.32     0.0001
AREA                     1      14.56134454     14.56134454     18.28     0.0002
AREA*FAMILY             15      14.41904762      0.96126984      1.21     0.3193
PERSON                   2       1.24201681      0.62100840      0.78     0.4676
AREA*PERSON              2       1.94789916      0.97394958      1.22     0.3087
Error                   30      23.89523810      0.79650794
Source for TIME.2       DF      Type III SS     Mean Square   F Value     Pr > F
MEAN                     1     209.84383452    209.84383452    374.93     0.0001
AREA                     1      56.72268908     56.72268908    101.35     0.0001
AREA*FAMILY             15      13.23809524      0.88253968      1.58     0.1404
PERSON                   2       1.48403361      0.74201681      1.33     0.2807
AREA*PERSON              2       1.01344538      0.50672269      0.91     0.4152
Error                   30      16.79047619      0.55968254
