how to create dum variable if there are many obs?

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

tanghanpost
Posts: 27
Joined: Tue Dec 30, 2008 6:39 am

how to create dum variable if there are many obs?

Postby tanghanpost » Fri Jan 02, 2009 2:15 am

dear all,
i have a panel data:100 crossid and 30 dateid, then when estimate fixed effection model there will be many dum variables, it will be so crazy for if input every one by hand. is there any command or function i can use in eviews? i mean is there any easy way to create many dum variables, just like the function @trend().
and, i don't know how to use the "if condition", like:
" genr dum1=1 if str>=20 and dum1=0 if str<20"
is this available?

thanks a lot!

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

Re: how to create dum variable if there are many obs?

Postby startz » Fri Jan 02, 2009 7:38 am

dear all,
i have a panel data:100 crossid and 30 dateid, then when estimate fixed effection model there will be many dum variables, it will be so crazy for if input every one by hand. is there any command or function i can use in eviews? i mean is there any easy way to create many dum variables, just like the function @trend().
and, i don't know how to use the "if condition", like:
" genr dum1=1 if str>=20 and dum1=0 if str<20"
is this available?

thanks a lot!
There are three options that might help:
(1) Use the fixed effect option for your estimate.
(2) Check out the @EXPAND function to see if it does what you want.
(3) Code your dummy variables with something like the following:

Code: Select all

smpl if str<20 series dum1=0 smpl if str>=20 dum1=1

Gene
EViews Expert
Posts: 20
Joined: Wed Sep 24, 2008 1:08 pm

Re: how to create dum variable if there are many obs?

Postby Gene » Fri Jan 02, 2009 11:48 am

(3) Code your dummy variables with something like the following:

Code: Select all

smpl if str<20 series dum1=0 smpl if str>=20 dum1=1
Alternatively, you can use @RECODE

Code: Select all

series dum1 = @recode(str<20,0,1)

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

Re: how to create dum variable if there are many obs?

Postby startz » Fri Jan 02, 2009 12:01 pm

(3) Code your dummy variables with something like the following:

Code: Select all

smpl if str<20 series dum1=0 smpl if str>=20 dum1=1
Alternatively, you can use @RECODE

Code: Select all

series dum1 = @recode(str<20,0,1)
or in this particularly easy case

Code: Select all

series dum1 = str>=20


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests