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

ecofin
Posts: 180
Joined: Fri May 10, 2013 11:24 am

Re: Dummy Variables

the problem is geralized the dummy for all series for daily date no-dated and quarterly .
daily:
series dum1= @recode((@date<=@dateval("31/01/1990")) or (@date>=@dateval("01/03/1990") and @date<=@dateval("31/03/1990")) or (...etc,1,0)

No-dated:
series dum2=@recode((@obsnum<=2) or (@obsnum>=5 and @obsnum<=6) or (...etc,1,0).

quarterly:
series dum3=@recode((@date<=@dateval("1990q04")) or (@date>=@dateval("1992q01") and @date<=@dateval("1992q04")) or (...etc,1,0)

it's long to write for all date, Have you an idea.
best regards.

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

Re: Dummy Variables

How many dates do you have? What's wrong with what you just wrote?

ecofin
Posts: 180
Joined: Fri May 10, 2013 11:24 am

Re: Dummy Variables

I have 400 obs, the problem it takes a lot of time to create dummy for large observations like my example with the function, if I have for example 1000 obs or 5000 obs what shall I do.
my example for NO-dated obs is: create dummy equal 1 for "1 2" obs next "5 6" obs next "9 10" obs next....etc, dummy equal 0 for "3 4" obs next "7 8" obs next "11 12" obs...etc, for all 400 obs.

my idea just to create regular dummy equal 1 for obs for example: 6 obs take 1 next 6 obs take 0 next 6 obs take 1...etc, you understand me.

best regards.

ecofin
Posts: 180
Joined: Fri May 10, 2013 11:24 am

Re: Dummy Variables

is there any way to reduce the function for dummy in my example because it's very long.

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

Re: Dummy Variables

I'm not certain that I understand all of the details of your computation, but there is a classify proc that should do what you want. It's described in detail in the manual. On a series, click on Proc/Classify (I'm not sure of the exact proc name and I'm away from the docs right now, but you should be able to find it).

ecofin
Posts: 180
Joined: Fri May 10, 2013 11:24 am

Re: Dummy Variables

ok I explain, just I would like to create dummy variable for my series No-dated, quarterly or monthly, daily data like this 11 00 11 00 11 00...etc or for quaterly data 1111 0000 1111 0000...etc, for monthly 12 obs take 1 and next 12 obs take 0...etc.
but the problem is very long to write it by the function like this for No-dated: series dum2=@recode((@obsnum<=2) or (@obsnum>=5 and @obsnum<=6) or (...etc,1,0), I can write it by the function for all my 400 obs, but it takes long time.
you understood me.

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

Re: Dummy Variables

I think I understand, my earlier response does apply.

Proc/Generate by Classification. Method: Limit Values. Choose the appropriate bin interval definition. Encoding: Index (0, 1, 2...)

Then use the new variable with @expand.

ecofin
Posts: 180
Joined: Fri May 10, 2013 11:24 am

Re: Dummy Variables

this my work file, I would like to create dummy for quarterly data like this 1111 0000 1111 0000 ...etc, my series 'x', how to use @expand.
Attachments
cpi.WF1

ecofin
Posts: 180
Joined: Fri May 10, 2013 11:24 am

Re: Dummy Variables

would you like to help me, how tu use @expand for the quarterly data or No-dated...etc, just create dummy like this 1111 0000 1111 0000...etc
kind regards.
Attachments
classify.png (23.14 KiB) Viewed 4047 times

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

Re: Dummy Variables

So you just want a dummy variable that has four 1s, followed by four 0s, followed by four 1s, followed by four 0s and so on?

Code: Select all

`series dum=@mod(@trend,8)<4`

ecofin
Posts: 180
Joined: Fri May 10, 2013 11:24 am

Re: Dummy Variables

thanks a lot Gareth and Glenn for your help and your reply .

jodai
Posts: 2
Joined: Wed Jan 08, 2014 1:15 pm

Re: Dummy Variables

I have dated (yearly) panel data and want to create a dummy variable that takes 1 exclusively for the three years previous to a specific change in the data and 0 otherwise. Specifically, I have a variable that changes over time and I want the dummy variable to take 1 in the three years previous to it getting bigger than 0.2. Any help is very much appreciated. Thank you in advance.

jodai
Posts: 2
Joined: Wed Jan 08, 2014 1:15 pm

Re: Dummy Variables

I did it in excel now, but I'd still be curious how it would work in eviews

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

Re: Dummy Variables

Code: Select all

`series dummy = x(1)>.2 or x(2)>.2 or x(3)>.2`

ariana
Posts: 1
Joined: Fri Jan 10, 2014 10:41 am

Re: Dummy Variables

hi
i have a question regarding to use year dummy variables in fixed effect model
when i add my dummy variable and i want to run a model it says singular matrix but without it i can use fixed effect
one more question is about using distance variable,you know that distance is not changing by time so it relates to cross section just ,but again when i want to run fixed effect it is not working,when i remove distance then it will be ok
i want to know what is the problem
thanks alot