You're not lost. We have a new look but the same content.

SAS Library
SAS Code for Some Advanced Experimental Designs

This page was adapted from a page titled SAS Code for Some Experiemental Designs  created by Oliver Schabenberger.  We thank Professor Schabenberger for permission to adapt and distribute this page via our web site.

DISCLAIMER: No guarantee is given for the correctness of the code herein.

Recently, PROC MIXED was added to the palette of SAS/STAT procedures. One of PROC MIXED strengths is the analysis of statistical models with combined random and fixed effects. Many experimental design situations that had a non-optimal solution in the otherwise powerful GLM procedure have now become much simpler. For example tests across whole- and split-plot factors in Split-Plot experiments, Block designs with random block effects etc. There is no room to discuss the common and disparate features of the GLM and MIXED procedures in detail. The interested user is pointed to

  • SAS System for Mixed Models. Littell, R.C.; Milliken, G.A.; Stroup, W.W.; Wolfinger, R.D., Cary, NC: SAS Institute Inc., 1996. 633pp.
  • SAS/STAT Software:Changes and Enhancements, Release 6.11, Cary, NC: SAS Institute, Inc. 1995.
  • SAS/STAT User's Guide, Version 6, Fourth Edition, Volume 2, Cary, NC: SAS Institute Inc., 1989. 846 pp.

Do not use the statements below blindly. The statements are rudimentary in that they do not produce all possible tests and contrasts for complex designs. Consult the manuals. This is true in particular for the TEST statement in PROC GLMas well as theLSMEANS, ESTIMATE, andCONTRAST statements in MIXED andGLM.

For a brief comparison ofPROC GLM andPROC MIXED, click here


A,B,C,... Experimental factors
A1,A2,A3,... Levels 1,2,3 of experimental factor A
A*B Interaction between factors A and B
Y The experimental response (what you measured)
Tx The treament factor in a non-factorial design
X Supplementary information (ANCOVA)
WhP Whole-plot factor in Split-Plot type design
SubP Sub-plot factor in Split-Plot type design
Rep Replications of a basic design

  1. Completely Randomized Design (CRD)
    1. CRD without subsampling
    2. CRD with subsampling
  2. Randomized Complete Block Designs (RCBD)
    1. RCBD with fixed block effects, without subsampling
    2. RCBD with fixed block effects, with subsampling
    3. RCBD with random block effects
  3. Multilocation RCBDs over time
    1. Different sites at each time point
    2. Same site at different time points (randomized separately at each time point)
  4. Generalized Randomized Complete Block Design (GRBD)
    1. GRBD with fixed block effects
    2. GRBD with random block effects
  5. Incomplete Block Designs (IBD)
    1. Incomplete, fixed blocks
    2. Intra-block analysis in incomplete random blocks
    3. Inter- and intra-block analysis in incomplete random blocks
  6. Latin Square Designs (LSD)
    1. Standard Latin Square
    2. Incomplete Latin Square
    3. Latin Rectangle
    4. Replicated LSD (rows and columns crossed w/ reps)
    5. Replicated LSD (rows nested, columns crossed w/ reps)
    6. Replicated LSD (rows crossed, columns nested w/ reps)
    7. Replicated LSD (rows and columns nested w/ reps)
    8. Graeco-Latin Square
  7. Split-Plot Designs (SPD)
    1. Standard SPD with whole-plot factor in a RCBD, replication fixed
    2. Standard SPD with whole-plot factor in a RCBD, replication random
    3. SPD with whole-plot factor in a CRD
    4. SPD with whole-plot factor in a GRBD
  8. Split-Block (Strip-Plot) Designs (SBD)
    1. Standard SBD, replications fixed
    2. Standard SBD, replications random
    3. SBDs: same sites at different times
    4. SBDs: different sites
  9. Split-Split-Plot Design (SSPD)

Completely Randomized Design (CRD)

Randomized Complete Block Designs (RCBD)

Multilocation RCBDs

Generalized Randomized Complete Block Design (GRBD)

Incomplete Block Designs (IBD)

Latin Square Designs

Split-Plot Designs (SPD)

Split-Block (Strip-Plot) Designs (SBD)

Split-Split-Plot Design (SSPD)



 proc glm data=yourdata;
   class rep a b c;
   model y = rep     a   rep*a
             b       a*b rep*a*b
             c       a*c b*c a*b*c;
   test h=a   e=rep*a;
   test h=b   e=rep*a*b;
   test h=a*b e=rep*a*b;
 proc mixed data=yourdata;
   class rep a b c;
   model y = rep     a
             b       a*b
             c       a*c b*c a*b*c ;
   random rep*a rep*a*b;

How to cite this page

Report an error on this page or leave a comment

The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.