Dummy Variables
Moderators: EViews Gareth, EViews Moderator
Re: Dummy Variables
the problem is geralized the dummy for all series for daily date nodated 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)
Nodated:
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.
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)
Nodated:
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.

 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?
Follow us on Twitter @IHSEViews
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 NOdated 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.
my example for NOdated 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.
Re: Dummy Variables
is there any way to reduce the function for dummy in my example because it's very long.

 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).
Re: Dummy Variables
ok I explain, just I would like to create dummy variable for my series Nodated, 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 Nodated: 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.
but the problem is very long to write it by the function like this for Nodated: 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 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.
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.
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
 (14.89 KiB) Downloaded 118 times
Re: Dummy Variables
would you like to help me, how tu use @expand for the quarterly data or Nodated...etc, just create dummy like this 1111 0000 1111 0000...etc
kind regards.
kind regards.
 Attachments

 classify.png (23.14 KiB) Viewed 4047 times

 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
Follow us on Twitter @IHSEViews
Re: Dummy Variables
thanks a lot Gareth and Glenn for your help and your reply .
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.
Re: Dummy Variables
I did it in excel now, but I'd still be curious how it would work in eviews

 Nonnormality 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
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
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
Who is online
Users browsing this forum: No registered users and 9 guests