* This if file KIDNEY.SAS ;
title 'Two way ANOVA--kidney ATPase data';
* Create data set with no missing data ;
DATA kidney;
infile kidney;
input A H N1 N2 Ngroup;
I1=H*N1;
I2=H*N2;
LABEL A='Sodium-potassium ATPase'
H='dummy variable =-1 if hypertensive'
N1='dummy variable = 1 if DCT group'
N2='dummy variable = 1 if CCD group'
I1='interaction of H and N1'
I2='interaction of H and N2'
Ngroup='group labels for site factor';
* Create data set with missing data (Data in Table 8-15 ;
DATA kidney1;
infile kidnymis;
input A H N1 N2 Ngroup;
I1=H*N1;
I2=H*N2;
LABEL A='Sodium-potassium ATPase'
H='dummy variable =-1 if hypertensive'
N1='dummy variable = 1 if DCT group'
N2='dummy variable = 1 if CCD group'
I1='interaction of H and N1'
I2='interaction of H and N2'
Ngroup='group labels for site factor';
* Create data set with missing cell (Data in Table 8-18) ;
DATA kidney2;
infile kidmiscl;
input A H N1 N2 Ngroup;
I1=H*N1;
I2=H*N2;
LABEL A='Sodium-potassium ATPase'
H='dummy variable =-1 if hypertensive'
N1='dummy variable = 1 if DCT group'
N2='dummy variable = 1 if CCD group'
I1='interaction of H and N1'
I2='interaction of H and N2'
Ngroup='group labels for site factor';
* Traditional analysis of variance ;
proc ANOVA data=kidney;
class H Ngroup;
model A=H Ngroup H*Ngroup;
means H Ngroup H*Ngroup/BON DUNCAN SNK;
* Analysis of variance using regression and dummy variables ;
proc REG data=kidney;
model A = H N1 N2 I1 I2/ SS1;
* MISSING DATA: all cells have data ;
* Analysis of variance using GLM procedure ;
proc GLM data=kidney1;
class H Ngroup;
model A=H Ngroup H*Ngroup/solution;
lsmeans H Ngroup H*Ngroup/stderr pdiff;
* MISSING DATA: all cells have data ;
* Dummy variable implementation with regression, once with H last ;
* once with N1 and N2 last, and once with interaction last ;
proc REG data=kidney1;
model A = N1 N2 I1 I2 H/ SS1;
model A = H I1 I2 N1 N2/ SS1;
model A = H N1 N2 I1 I2/ SS1;
* MISSING DATA: one cell empty ;
* Analysis of variance using GLM procedure ;
proc GLM data=kidney2;
class H Ngroup;
model A=H Ngroup H*Ngroup/solution;
lsmeans H Ngroup H*Ngroup/stderr pdiff;
proc GLM data=kidney2;
class H Ngroup;
model A=H Ngroup /solution;
lsmeans H Ngroup /stderr pdiff;
* MISSING DATA: one cell empty ;
* Dummy variable implementation with regression, once with H last ;
* and once with N1 and N2 last ;
proc REG data=kidney2;
model A = N1 N2 H/ SS1;
model A = H N1 N2/ SS1;