data drying;
   infile 'drying.dat' firstobs = 2;
   input obs cow period sample drying dmrem cprem;

proc mixed data = drying;
   class cow period sample drying;
   model dmrem = cow | period | drying;
   random sample(period) drying*sample(period);
   lsmeans period*drying;
proc mixed data = drying;
   class cow period sample drying;
   model dmrem = cprem cow | period | drying;
   random sample(period) drying*sample(period);
   lsmeans period*drying;
The Mixed Procedure
Dependent Variable           dmrem                    
             Class Level Information
Class     Levels    Values
cow            3    2524 2530 2541                
period         3    1 2 3                         
sample        30    1 2 3 4 5 6 7 8 9 10 11 12 13 
                    14 15 16 17 18 19 20 21 22 23 
                    24 25 26 27 28 29 30          
drying         3    1 2 3                         
Covariance Parameters             3
Columns in X                     64
Columns in Z                    120
Subjects                          1
Max Obs Per Subject             270
Observations Used               259
Observations Not Used            11
Total Observations              270
 Covariance Parameter Estimates
Cov Parm                 Estimate
sample(period)           0.001666
sampl*drying(period)     0.000096
Residual                 0.000966
           Fitting Information
Res Log Likelihood                   401.4
Akaike's Information Criterion       398.4
Schwarz's Bayesian Criterion         396.3
-2 Res Log Likelihood               -802.9
            Type 3 Tests of Fixed Effects
                      Num     Den
Effect                 DF      DF    F Value    Pr > F
cow                     2     151      11.49    <.0001
period                  2      27       0.67    0.5219
cow*period              4     151       1.12    0.3504
drying                  2      54       1.95    0.1522
cow*drying              4     151       1.06    0.3776
period*drying           4      54       5.02    0.0016
cow*period*drying       8     151       2.43    0.0167
                           Least Squares Means
                                         Standard
Effect         period  drying  Estimate     Error    DF  t Value  Pr > |t|
period*drying  1       1         0.2893   0.01381    54    20.95    <.0001
period*drying  1       2         0.2884   0.01385    54    20.82    <.0001
period*drying  1       3         0.2846   0.01386    54    20.53    <.0001
period*drying  2       1         0.2931   0.01453    54    20.17    <.0001
period*drying  2       2         0.2546   0.01449    54    17.57    <.0001
period*drying  2       3         0.2573   0.01449    54    17.76    <.0001
period*drying  3       1         0.2788   0.01522    54    18.32    <.0001
period*drying  3       2         0.2883   0.01533    54    18.81    <.0001
period*drying  3       3         0.2947   0.01522    54    19.37    <.0001
The Mixed Procedure
Dependent Variable           dmrem                    
             Class Level Information
Class     Levels    Values
cow            3    2524 2530 2541                
period         3    1 2 3                         
sample        30    1 2 3 4 5 6 7 8 9 10 11 12 13 
                    14 15 16 17 18 19 20 21 22 23 
                    24 25 26 27 28 29 30          
drying         3    1 2 3                         
Covariance Parameters             3
Columns in X                     65
Columns in Z                    120
Subjects                          1
Max Obs Per Subject             270
Observations Used               258
Observations Not Used            12
Total Observations              270
 Covariance Parameter Estimates
Cov Parm                 Estimate
sample(period)           0.000184
sampl*drying(period)     0.000045
Residual                 0.000122
           Fitting Information
Res Log Likelihood                   624.9
Akaike's Information Criterion       621.9
Schwarz's Bayesian Criterion         619.8
-2 Res Log Likelihood              -1249.7
            Type 3 Tests of Fixed Effects
                      Num     Den
Effect                 DF      DF    F Value    Pr > F
cprem                   1     149    1461.81    <.0001
cow                     2     149       7.67    0.0007
period                  2      27       5.78    0.0081
cow*period              4     149       2.91    0.0236
drying                  2      54      21.14    <.0001
cow*drying              4     149       0.73    0.5713
period*drying           4      54       3.86    0.0078
cow*period*drying       8     149       2.86    0.0055
                           Least Squares Means
                                         Standard
Effect         period  drying  Estimate     Error    DF  t Value  Pr > |t|
period*drying  1       1         0.2717  0.004993    54    54.41    <.0001
period*drying  1       2         0.2861  0.004987    54    57.36    <.0001
period*drying  1       3         0.2977  0.005002    54    59.52    <.0001
period*drying  2       1         0.2671  0.005278    54    50.60    <.0001
period*drying  2       2         0.2649  0.005223    54    50.71    <.0001
period*drying  2       3         0.2731  0.005233    54    52.19    <.0001
period*drying  3       1         0.2797  0.005479    54    51.04    <.0001
period*drying  3       2         0.2930  0.005570    54    52.61    <.0001
period*drying  3       3         0.2965  0.005479    54    54.11    <.0001
