PROC MIXED DATA=TRY;
CLASS TREATMENT PERIOD SEQUENCE SUBJECT;
MODEL CONC=TREATMENT PERIOD SEQUENCE/SOLUTION;
RANDOM SUBJECT(SEQUENCE);
LSMEANS TREATMENT/PDIFF=control("A","B") CL ALPHA=0.1 ;
RUN;
PROC MIXED DATA=TRY;
CLASS TREATMENT PERIOD SEQUENCE SUBJECT;
MODEL CONC=TREATMENT PERIOD SEQUENCE SUBJECT(SEQUENCE)/SOLUTION;
LSMEANS TREATMENT/PDIFF=control("A","B") CL ALPHA=0.1 ;
RUN;
The SAS System |
If WE treat subject(sequence ) as fixed effect
The Mixed Procedure
Model Information | |
Data Set | WORK.TRY |
Dependent Variable | CONC |
Covariance Structure | Diagonal |
Estimation Method | REML |
Residual Variance Method | Profile |
Fixed Effects SE Method | Model-Based |
Degrees of Freedom Method | Residual |
Class Level Information | ||
Class | Levels | Values |
TREATMENT | 2 | A B |
PERIOD | 2 | 1 2 |
SEQUENCE | 2 | 1 2 |
SUBJECT | 10 | 001 002 003 004 005 006 007 008 009 010 |
Dimensions | |
Covariance Parameters | 1 |
Columns in X | 17 |
Columns in Z | 0 |
Subjects | 1 |
Max Obs Per Subject | 20 |
Number of Observations | |
Number of Observations Read | 20 |
Number of Observations Used | 20 |
Number of Observations Not Used | 0 |
Covariance Parameter Estimates | |
Cov Parm | Estimate |
Residual | 0.4089 |
Fit Statistics | |
-2 Res Log Likelihood | 25.7 |
AIC (smaller is better) | 27.7 |
AICC (smaller is better) | 28.4 |
BIC (smaller is better) | 27.8 |
Solution for Fixed Effects | |||||||||
Effect | TREATMENT | SUBJECT | PERIOD | SEQUENCE | Estimate | Standard Error | DF | t Value | Pr > |t| |
Intercept |
|
|
|
| 3.1780 | 0.4953 | 8 | 6.42 | 0.0002 |
TREATMENT | A |
|
|
| 1.0800 | 0.2860 | 8 | 3.78 | 0.0054 |
TREATMENT | B |
|
|
| 0 | . | . | . | . |
PERIOD |
|
| 1 |
| -0.1160 | 0.2860 | 8 | -0.41 | 0.6956 |
PERIOD |
|
| 2 |
| 0 | . | . | . | . |
SEQUENCE |
|
|
| 1 | -0.7100 | 0.6395 | 8 | -1.11 | 0.2991 |
SEQUENCE |
|
|
| 2 | 0 | . | . | . | . |
SUBJECT(SEQUENCE) |
| 001 |
| 1 | -0.1750 | 0.6395 | 8 | -0.27 | 0.7913 |
SUBJECT(SEQUENCE) |
| 002 |
| 1 | -0.4000 | 0.6395 | 8 | -0.63 | 0.5490 |
SUBJECT(SEQUENCE) |
| 003 |
| 1 | 0.3850 | 0.6395 | 8 | 0.60 | 0.5638 |
SUBJECT(SEQUENCE) |
| 004 |
| 1 | 1.5200 | 0.6395 | 8 | 2.38 | 0.0448 |
SUBJECT(SEQUENCE) |
| 007 |
| 1 | 0 | . | . | . | . |
SUBJECT(SEQUENCE) |
| 005 |
| 2 | -0.5500 | 0.6395 | 8 | -0.86 | 0.4148 |
SUBJECT(SEQUENCE) |
| 006 |
| 2 | 0.5000 | 0.6395 | 8 | 0.78 | 0.4568 |
SUBJECT(SEQUENCE) |
| 008 |
| 2 | -1.0100 | 0.6395 | 8 | -1.58 | 0.1529 |
SUBJECT(SEQUENCE) |
| 009 |
| 2 | -1.6400 | 0.6395 | 8 | -2.56 | 0.0334 |
SUBJECT(SEQUENCE) |
| 010 |
| 2 | 0 | . | . | . | . |
Type 3 Tests of Fixed Effects | ||||
Effect | Num DF | Den DF | F Value | Pr > F |
TREATMENT | 1 | 8 | 14.26 | 0.0054 |
PERIOD | 1 | 8 | 0.16 | 0.6956 |
SEQUENCE | 1 | 8 | 0.11 | 0.7457 |
SUBJECT(SEQUENCE) | 8 | 8 | 3.12 | 0.0641 |
Least Squares Means | |||||||||
Effect | TREATMENT | Estimate | Standard Error | DF | t Value | Pr > |t| | Alpha | Lower | Upper |
TREATMENT | A | 3.7080 | 0.2022 | 8 | 18.34 | <.0001 | 0.1 | 3.3320 | 4.0840 |
TREATMENT | B | 2.6280 | 0.2022 | 8 | 13.00 | <.0001 | 0.1 | 2.2520 | 3.0040 |
Differences of Least Squares Means | ||||||||||
Effect | TREATMENT | _TREATMENT | Estimate | Standard Error | DF | t Value | Pr > |t| | Alpha | Lower | Upper |
TREATMENT | B | A | -1.0800 | 0.2860 | 8 | -3.78 | 0.0054 | 0.1 | -1.6118 | -0.5482 |
PROC MIXED DATA=TRY;
CLASS TREATMENT PERIOD SEQUENCE SUBJECT;
MODEL CONC=TREATMENT PERIOD SEQUENCE/SOLUTION;
RANDOM SUBJECT(SEQUENCE);
LSMEANS TREATMENT/PDIFF=control("A","B") CL ALPHA=0.1 ;
RUN;
PROC MIXED DATA=TRY;
CLASS TREATMENT PERIOD SEQUENCE SUBJECT;
MODEL CONC=TREATMENT PERIOD SEQUENCE SUBJECT(SEQUENCE)/SOLUTION;
LSMEANS TREATMENT/PDIFF=control("A","B") CL ALPHA=0.1 ;
RUN;
The SAS System |
If WE treat subject(sequence ) as fixed effect
The Mixed Procedure
Model Information | |
Data Set | WORK.TRY |
Dependent Variable | CONC |
Covariance Structure | Diagonal |
Estimation Method | REML |
Residual Variance Method | Profile |
Fixed Effects SE Method | Model-Based |
Degrees of Freedom Method | Residual |
Class Level Information | ||
Class | Levels | Values |
TREATMENT | 2 | A B |
PERIOD | 2 | 1 2 |
SEQUENCE | 2 | 1 2 |
SUBJECT | 10 | 001 002 003 004 005 006 007 008 009 010 |
Dimensions | |
Covariance Parameters | 1 |
Columns in X | 17 |
Columns in Z | 0 |
Subjects | 1 |
Max Obs Per Subject | 20 |
Number of Observations | |
Number of Observations Read | 20 |
Number of Observations Used | 20 |
Number of Observations Not Used | 0 |
Covariance Parameter Estimates | |
Cov Parm | Estimate |
Residual | 0.4089 |
Fit Statistics | |
-2 Res Log Likelihood | 25.7 |
AIC (smaller is better) | 27.7 |
AICC (smaller is better) | 28.4 |
BIC (smaller is better) | 27.8 |
Solution for Fixed Effects | |||||||||
Effect | TREATMENT | SUBJECT | PERIOD | SEQUENCE | Estimate | Standard Error | DF | t Value | Pr > |t| |
Intercept |
|
|
|
| 3.1780 | 0.4953 | 8 | 6.42 | 0.0002 |
TREATMENT | A |
|
|
| 1.0800 | 0.2860 | 8 | 3.78 | 0.0054 |
TREATMENT | B |
|
|
| 0 | . | . | . | . |
PERIOD |
|
| 1 |
| -0.1160 | 0.2860 | 8 | -0.41 | 0.6956 |
PERIOD |
|
| 2 |
| 0 | . | . | . | . |
SEQUENCE |
|
|
| 1 | -0.7100 | 0.6395 | 8 | -1.11 | 0.2991 |
SEQUENCE |
|
|
| 2 | 0 | . | . | . | . |
SUBJECT(SEQUENCE) |
| 001 |
| 1 | -0.1750 | 0.6395 | 8 | -0.27 | 0.7913 |
SUBJECT(SEQUENCE) |
| 002 |
| 1 | -0.4000 | 0.6395 | 8 | -0.63 | 0.5490 |
SUBJECT(SEQUENCE) |
| 003 |
| 1 | 0.3850 | 0.6395 | 8 | 0.60 | 0.5638 |
SUBJECT(SEQUENCE) |
| 004 |
| 1 | 1.5200 | 0.6395 | 8 | 2.38 | 0.0448 |
SUBJECT(SEQUENCE) |
| 007 |
| 1 | 0 | . | . | . | . |
SUBJECT(SEQUENCE) |
| 005 |
| 2 | -0.5500 | 0.6395 | 8 | -0.86 | 0.4148 |
SUBJECT(SEQUENCE) |
| 006 |
| 2 | 0.5000 | 0.6395 | 8 | 0.78 | 0.4568 |
SUBJECT(SEQUENCE) |
| 008 |
| 2 | -1.0100 | 0.6395 | 8 | -1.58 | 0.1529 |
SUBJECT(SEQUENCE) |
| 009 |
| 2 | -1.6400 | 0.6395 | 8 | -2.56 | 0.0334 |
SUBJECT(SEQUENCE) |
| 010 |
| 2 | 0 | . | . | . | . |
Type 3 Tests of Fixed Effects | ||||
Effect | Num DF | Den DF | F Value | Pr > F |
TREATMENT | 1 | 8 | 14.26 | 0.0054 |
PERIOD | 1 | 8 | 0.16 | 0.6956 |
SEQUENCE | 1 | 8 | 0.11 | 0.7457 |
SUBJECT(SEQUENCE) | 8 | 8 | 3.12 | 0.0641 |
Least Squares Means | |||||||||
Effect | TREATMENT | Estimate | Standard Error | DF | t Value | Pr > |t| | Alpha | Lower | Upper |
TREATMENT | A | 3.7080 | 0.2022 | 8 | 18.34 | <.0001 | 0.1 | 3.3320 | 4.0840 |
TREATMENT | B | 2.6280 | 0.2022 | 8 | 13.00 | <.0001 | 0.1 | 2.2520 | 3.0040 |
Differences of Least Squares Means | ||||||||||
Effect | TREATMENT | _TREATMENT | Estimate | Standard Error | DF | t Value | Pr > |t| | Alpha | Lower | Upper |
TREATMENT | B | A | -1.0800 | 0.2860 | 8 | -3.78 | 0.0054 | 0.1 | -1.6118 | -0.5482 |
See my answer to this here:
Steve Denham
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.