eviews 7: creating age category dummies

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

totallyheart
Posts: 3
Joined: Thu Mar 24, 2011 6:20 am

eviews 7: creating age category dummies

Postby totallyheart » Thu Mar 24, 2011 7:48 am

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!

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13603
Joined: Tue Sep 16, 2008 5:38 pm

Re: eviews 7: creating age category dummies

Postby EViews Gareth » Thu Mar 24, 2011 7:50 am

Do you currently have a variable that contains age information?

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: eviews 7: creating age category dummies

Postby EViews Glenn » Thu Mar 24, 2011 9:11 am

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.

totallyheart
Posts: 3
Joined: Thu Mar 24, 2011 6:20 am

Re: eviews 7: creating age category dummies

Postby totallyheart » Fri Mar 25, 2011 12:54 am

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! :) ...

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13603
Joined: Tue Sep 16, 2008 5:38 pm

Re: eviews 7: creating age category dummies

Postby EViews Gareth » Fri Mar 25, 2011 7:53 am

Do you currently have a variable that contains age information?

totallyheart
Posts: 3
Joined: Thu Mar 24, 2011 6:20 am

Re: eviews 7: creating age category dummies

Postby totallyheart » Sat Mar 26, 2011 6:31 am

yes, i do

startz
Non-normality and collinearity are NOT problems!
Posts: 3797
Joined: Wed Sep 17, 2008 2:25 pm

Re: eviews 7: creating age category dummies

Postby startz » Sat Mar 26, 2011 7:51 am

Try

Code: Select all

series dum_1 smpl @all dum_1 = 0 smpl if age>=21 or age<=30 dum_1 = 1

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: eviews 7: creating age category dummies

Postby EViews Glenn » Mon Mar 28, 2011 9:32 am

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.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests