Page 1 of 1

how to create dum variable if there are many obs?

Posted: Fri Jan 02, 2009 2:15 am
by tanghanpost
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!

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

Posted: Fri Jan 02, 2009 7:38 am
by startz
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

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

Posted: Fri Jan 02, 2009 11:48 am
by Gene
(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)

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

Posted: Fri Jan 02, 2009 12:01 pm
by startz
(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