options linesize=78 pagesize=56 ; /* This SAS program performs an ANOVA on the data presented in the book from a nested design */ data nested ; input site batch drug @@ ; cards ; 1 1 5.03 1 1 5.1 1 1 5.25 1 1 4.98 1 1 5.05 1 2 4.64 1 2 4.73 1 2 4.82 1 2 4.95 1 2 5.06 1 3 5.1 1 3 5.15 1 3 5.2 1 3 5.08 1 3 5.14 2 1 5.05 2 1 4.96 2 1 5.12 2 1 5.12 2 1 5.05 2 2 5.46 2 2 5.15 2 2 5.18 2 2 5.18 2 2 5.11 2 3 4.9 2 3 4.95 2 3 4.86 2 3 4.86 2 3 5.07 ; run ; proc print ; run ; * Using Proc MIXED to analyze the data ; proc mixed data = nested ; class site batch ; model drug = site / outp = rnested ; random batch(site) ; run ; * check residuals ; proc plot vpercent = 80 data = rnested ; plot resid*pred ; run ; proc capability noprint lineprinter data = rnested ; var resid ; qqplot resid / normal (mu = est sigma = est symbol = '.') square ; run ; * Here we use Proc GLM to analyze the data ; proc glm data = nested ; class site batch ; model drug = site batch(site) ; test h = site e = batch(site) ; run ;