Page 1 of 1
eviews 7: creating age category dummies
Posted: Thu Mar 24, 2011 7:48 am
by totallyheart
Hi,
I'd be really grateful if someone could help me...
I need to create 7 age category dummies for my regression.
My age categories will be:
< 20 (which i will use as my reference group so dont need a dummy)
21-30
31-40
41-50
51-60
61-70
71-80
> 80
Im using eviews 7 and have tried the following to create my first category dummy:
series dum_1
smpl @ all
dum_1 = 0
smpl 21 30
dum_1 = 1
which didnt work :(
please can someone help?
thank you!
Re: eviews 7: creating age category dummies
Posted: Thu Mar 24, 2011 7:50 am
by EViews Gareth
Do you currently have a variable that contains age information?
Re: eviews 7: creating age category dummies
Posted: Thu Mar 24, 2011 9:11 am
by EViews Glenn
To expand on Gareth's comments, the smpl statements you employed were using the order of observations in the workfile to define the dummies not the ages.
Assuming that you have an age variable. If all you want to do is use the dummies in an equation, you can do this in two steps:
1. use the Proc/Generate by Classification series proc and the age variable with your specified limit values to create an index variable (0, 1, 2... ) with the age categories (series proc name classify).
2. use the @expand function on your newly created index variable to create dummies on the fly for use in the equation.
Check the documentation for Classification, from series for a discussion of the classification proc.
Re: eviews 7: creating age category dummies
Posted: Fri Mar 25, 2011 12:54 am
by totallyheart
Hi
thanks for getting back to me so soon.
Im sorry to be a pain, but as im a beginner to eviews i didnt quite understand the steps to creating these dummies.
If you could go over it in layman terms it would be great! :) ...
Re: eviews 7: creating age category dummies
Posted: Fri Mar 25, 2011 7:53 am
by EViews Gareth
Do you currently have a variable that contains age information?
Re: eviews 7: creating age category dummies
Posted: Sat Mar 26, 2011 6:31 am
by totallyheart
yes, i do
Re: eviews 7: creating age category dummies
Posted: Sat Mar 26, 2011 7:51 am
by startz
Try
Code: Select all
series dum_1
smpl @all
dum_1 = 0
smpl if age>=21 or age<=30
dum_1 = 1
Re: eviews 7: creating age category dummies
Posted: Mon Mar 28, 2011 9:32 am
by EViews Glenn
I assume you mean "age < 21" for your first category.
The code
Code: Select all
age.classify(method=limits) 21 31 41 51 61 71 81 @ agecat
should create your age category variable AGECAT.
Then in your regression specification, you can do
Code: Select all
equation eq1.ls y c @expand(agecat, @dropfirst)
which will create the dummies in the regression, dropping the first category.