Learner
Posts: 1

# Interaction for Two-Way ANOVA in Proc GLM not showing up

Hello all,

I am trying to conduct a two-way ANOVA with 8 observations, independent variables Income (5 levels) and Age (4 levels), and dependent variable Rates.  The independent variables started out as numbers, so to make them categorical I used statements such as

if income<35000 and income>40000 then inlevel='First';

I then used the following procedure:

proc glm data=works;

class income age;

model rates = income age income*age;

run;

The output was working fine until it hit the interaction effects.  In the SS output, the interaction effects are just showing missing values.  Does this mean I have too few observations and the interaction effects are too small?  Or should I not be using categorical variables?  This is all using SAS University, by the way.

SAS Super FREQ
Posts: 3,835

## Re: Interaction for Two-Way ANOVA in Proc GLM not showing up

Is there a typo in your binning statement?

You said

if income<35000 and income>40000 then inlevel='First';

but you are using INCOME as a class variable in PROC GLM.  Did you mean to use INLEVEL?

When you put INCOME on the CLASS statement, it is trying to fit every unique value of INCOME as a distinct level!

BTW, coding the levels as 1, 2, 3,...    will be easier to handle than 'first', 'second', 'third'.

Posts: 5,045

## Re: Interaction for Two-Way ANOVA in Proc GLM not showing up

You have too few observations for the number of quantities that you are trying to estimate. Try defining only two levels of income and two levels of age. For example :

``````proc rank data=works out=rworks groups=2;
var income age;
run;

proc glm data=rworks;
class income age;
model rates = income age income*age;
run;``````
PG
SAS Super FREQ
Posts: 3,835

## Re: Interaction for Two-Way ANOVA in Proc GLM not showing up

Also, the way you are discretizing your INCOME variable seems strange.  You are assigning the same category to the high and low values. Was that intentional?  Typically people use cutpoints to discretize:

if income<35000 then inlevel=1;

else if income>=35000 and income<50000 then inlevel=2;

else if income>=50000 and income<80000 then inlevel=3;

etc;

Discussion stats
• 3 replies
• 273 views
• 0 likes
• 3 in conversation