Hello, I have to create several dummies for different points in time, so I want to know if there is a way to input the "1" value in a serie using commands
for example (monthly data):
genr dum_feb_2016=0
For that variable (dum_feb_2016) I need to insert a 1 in the date 2016m02 leaving the rest of the serie as zeros.
Any help is appreciated
Input value at specific date
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
startz
- Non-normality and collinearity are NOT problems!
- Posts: 3797
- Joined: Wed Sep 17, 2008 2:25 pm
Re: Input value at specific date
One way is
Code: Select all
smpl 2016m02 2016m02
dum_feb_2016 = 1
smpl @all-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Input value at specific date
Startz' is the best general solution, but in your case the best method is probably:
Code: Select all
series dum = @event("2016m2")
Re: Input value at specific date
hi,
1/to input value one to at specific date it's easy series dum = @event("2016m2"), but what this mean [date2] and [basis] in this function @event("date1 [date2]", [basis]) its like @holiday function, could you explain when i use this function (@event) and can you give an example with this function to understand,
2/when i use this function to put value 1 for some specific days example series dum = @event("2005m2 2005m3 2005m5....etc") dosn't work.
suppose i have frequency monthly obs 93 from 2005m1 2012m9 93 what's the benefit of the @event.
thanks in advance.
1/to input value one to at specific date it's easy series dum = @event("2016m2"), but what this mean [date2] and [basis] in this function @event("date1 [date2]", [basis]) its like @holiday function, could you explain when i use this function (@event) and can you give an example with this function to understand,
2/when i use this function to put value 1 for some specific days example series dum = @event("2005m2 2005m3 2005m5....etc") dosn't work.
suppose i have frequency monthly obs 93 from 2005m1 2012m9 93 what's the benefit of the @event.
thanks in advance.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Input value at specific date
Your post is a bit garbled, but I think the help system explains the function:
http://www.eviews.com/help/helpintro.ht ... on.html%23
This example probably highlights it pretty well too:
Change the frequency to different things to see the differences.
http://www.eviews.com/help/helpintro.ht ... on.html%23
This example probably highlights it pretty well too:
Code: Select all
%freq = "d7"
wfcreate {%freq} 2016 2016
show @event("2016m2")
show @event("2016m2", "mon-fri")
Re: Input value at specific date
ok i understand :D
1/in the help"date1 [date2]" mean that i can chose pair of dates but by this code i get error "Syntax error"
so what does mean [date2]? and how can do my pair "2016m2" "2016m4" "2016m6 2016m7" example by @event?
could you give me another example with pair of dates in the range.
2/this code make dummy for the second month in 2016
series dum1= @event("2016m2")<>0 but when i use series dum1= @event("2016m2")<>1 it can not reverse the dummy, all value take one.
1/in the help"date1 [date2]" mean that i can chose pair of dates but by this code i get error "Syntax error"
Code: Select all
series dum2= @event("2016m2" "2016m4" "2016m6 2016m7", "mon-fri")<>0could you give me another example with pair of dates in the range.
2/this code make dummy for the second month in 2016
series dum1= @event("2016m2")<>0 but when i use series dum1= @event("2016m2")<>1 it can not reverse the dummy, all value take one.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Input value at specific date
Code: Select all
%freq = "d7"
wfcreate {%freq} 2016 2016
show @event("2016m2")
show @event("2016m2 2016m4", "mon-fri")
Is @event("2016m2") equal to 1?
Re: Input value at specific date
I've got it!, thank you.
-
AntonioAcha
- Posts: 21
- Joined: Wed Jan 07, 2015 8:49 am
Re: Input value at specific date
Thanks all for the help, @event seems to be my solution, but one more question. Due to I need to do it a lot of times, I wrote this code:
for !i=1 to 12
for !j=1 to 6
genr dum_!i_201!j= @event("201!jm!i")
next
next
the part inside the brackets is generating an error, is there a way to make this?
If I can fix that, that code will create a code with a dummy for each month :)
regards
for !i=1 to 12
for !j=1 to 6
genr dum_!i_201!j= @event("201!jm!i")
next
next
the part inside the brackets is generating an error, is there a way to make this?
If I can fix that, that code will create a code with a dummy for each month :)
regards
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Input value at specific date
The precise answer to your question is:
But if you want to create a dummy for every month over a period, this is almost certainly not the best way to do it. What's the structure of your workfile (frequency, start/end date), and what do you plan on doing with the dummies?
Code: Select all
for !i=1 to 12
for !j=1 to 6
%date = "201" + @str(!j) + "m" + @str(!i)
genr dum_!i_201!j= @event(%date)
next
next
Who is online
Users browsing this forum: No registered users and 2 guests
