Page 1 of 1

Dummy Variables

Posted: Wed Jul 06, 2011 3:46 am
by lost_student
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.

Re: Dummy Variables

Posted: Wed Jul 06, 2011 6:50 am
by startz
smpl @all
series female = 0
smpl if gender=2
female = 1
smpl @all

Re: Dummy Variables

Posted: Wed Jul 06, 2011 9:12 am
by EViews Glenn
Or you could use @recode

Code: Select all

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

Re: Dummy Variables

Posted: Wed Jul 06, 2011 9:14 am
by EViews Gareth
Or, just simply:

Code: Select all

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

Re: Dummy Variables

Posted: Wed Jul 06, 2011 10:10 am
by EViews Glenn
Oh yeah. That's even better :)

Re: Dummy Variables

Posted: Thu Jul 07, 2011 3:37 am
by lost_student
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.