Dummy Variables

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

lost_student
Posts: 2
Joined: Wed Jul 06, 2011 3:42 am

Dummy Variables

Postby lost_student » Wed Jul 06, 2011 3:46 am

I really new to Eviews and im a bit stuck.

I need to create dummy variables for various different variables.

I have data for gender e.g 1= male and 2= female
However i would like it to read -
female = 1 if female, 0 if otherwise
male = 1 if male, 0 if otherwise

If someone could point me in the right direction it would be great.

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

Re: Dummy Variables

Postby startz » Wed Jul 06, 2011 6:50 am

smpl @all
series female = 0
smpl if gender=2
female = 1
smpl @all

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

Re: Dummy Variables

Postby EViews Glenn » Wed Jul 06, 2011 9:12 am

Or you could use @recode

Code: Select all

series male = @recode(gender=1, 1, 0) series female = @recode(gender=2, 1, 0)

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

Re: Dummy Variables

Postby EViews Gareth » Wed Jul 06, 2011 9:14 am

Or, just simply:

Code: Select all

series male = gender=1 series female = gender=2

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

Re: Dummy Variables

Postby EViews Glenn » Wed Jul 06, 2011 10:10 am

Oh yeah. That's even better :)

lost_student
Posts: 2
Joined: Wed Jul 06, 2011 3:42 am

Re: Dummy Variables

Postby lost_student » Thu Jul 07, 2011 3:37 am

Thanks for the help, could someone tell me how to run the code please! (yes i'm really that bad at this)

EDIT: never mind i figures it out.


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 2 guests