BookmarkSubscribeRSS Feed
gdona
Calcite | Level 5

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.

 

Thanks for your help!

3 REPLIES 3
Rick_SAS
SAS Super FREQ

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'.

 

PGStats
Opal | Level 21

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
Rick_SAS
SAS Super FREQ

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;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

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