data unbal ; input y factor1 factor2 ; * using the following coding scheme for x1, x2, and x3 it can be shown that the test for b1 is the test for the factor1 main effect, the test for b2 is the test for the factor2 main effect, and the test for b3 is the test for factor1 by factor2 interaction ; x1 = (factor1 = 1) ; if x1 = 0 then x1 = -1 ; x2 = (factor2 = 1) ; if x2 = 0 then x2 = -1 ; x3 = x1*x2 ; cards ; 7 1 1 5 1 1 3 1 1 5 1 2 9 2 1 6 2 2 9 2 2 12 2 2 run ; proc print ; * the regression sums of squares from these models can be compared to test for the factor 1 main effect, the factor 2 main effect, and the factor1 by factor2 interaction ; proc reg ; model y = ; model y = x1 ; model y = x2 ; model y = x1 x2 ; model y = x2 x3 ; model y = x1 x2 x3 ; run ; * Proc GLM is performed in different orders to show how Type I SS differs ; proc glm ; class factor1 factor2 ; model y = factor2 factor1 factor1*factor2 ; run ; proc glm ; class factor1 factor2 ; model y = factor1 factor2 factor1*factor2 ; run ;