generate dummy for weekday
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
generate dummy for weekday
hi,
i have 574 obs weekly, i would like to create dummy equal 1 for the first and last week in the month for every years.
thanks in advance.
i have 574 obs weekly, i would like to create dummy equal 1 for the first and last week in the month for every years.
thanks in advance.
- Attachments
-
- dummy-week.png (77.15 KiB) Viewed 12804 times
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: generate dummy for weekday
What is the first week of a month? Weeks and months do not align.
Re: generate dummy for weekday
1-there is no solution for this case, can you solve this problem in the future Mr Gareth by new function for this case.
2-now if i would create dummy equal to 1 for the first third fifth month...etc for every years what can i do? just i have manipulate data by this function but I could not get the desired result, or if there is another way.
thanks in advance.
2-now if i would create dummy equal to 1 for the first third fifth month...etc for every years what can i do? just i have manipulate data by this function but I could not get the desired result, or if there is another way.
Code: Select all
smpl @all
series dum=0
smpl if @mod(@year,1)=0 and @mod(@month,3)<2
dum=1Code: Select all
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: generate dummy for weekday
I don't think you understood.
Ignoring EViews, for the moment, how do you define the first week of a month?
Ignoring EViews, for the moment, how do you define the first week of a month?
Re: generate dummy for weekday
you mean the dated-regular frequancy (weekly)
1-create dummy equal 1 for the first and last week in the month for every years.
2-create dummy eqaul 1 for the first third month...etc for every years.
see the picture below, I have ateched my workfile.
1-create dummy equal 1 for the first and last week in the month for every years.
2-create dummy eqaul 1 for the first third month...etc for every years.
see the picture below, I have ateched my workfile.
- Attachments
-
- ase-week.wf1
- (17.75 KiB) Downloaded 460 times
-
- weekly-dummy.png (75.83 KiB) Viewed 12763 times
-
startz
- Non-normality and collinearity are NOT problems!
- Posts: 3798
- Joined: Wed Sep 17, 2008 2:25 pm
Re: generate dummy for weekday
The first day of October this year was a Wednesday. Is the week in which Sunday was September 28 the last week of September or the first week of October?
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: generate dummy for weekday
Again, ignore EViews for the moment. Just define, in words, what the first week of a month is.
Re: generate dummy for weekday
the first week of a month is Monday. sorry! 
-
startz
- Non-normality and collinearity are NOT problems!
- Posts: 3798
- Joined: Wed Sep 17, 2008 2:25 pm
Re: generate dummy for weekday
Would I be reading your definition correctly to say that the month that a week belongs to is defined by the month that the Monday of that week belongs to?the first week of a month is Monday. sorry!
Re: generate dummy for weekday
how can we solve this problem Mr. Startz if it is your case.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: generate dummy for weekday
Which day of the week is your workfile structured on? (i.e. in your workfile, which day of the week do weeks start on)?
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: generate dummy for weekday
Assuming your weeks start on a Monday (which 01-01-1990 was),
Code: Select all
'day at the beginning of this week (a monday) is in the first seven days of this month
series first = @date < @datefloor(@date,"month") + 7
'day at the beginning of next week (a monday) is within the next month
series last = @enddate+1 >= @dateadd(@datefloor(@date,"month"),1, "month")
Re: generate dummy for weekday
it's that what i need :) thanks Mr Gareth & Mr Startz.
for my second question: create dummy equal 1 for the 1st month 3rd month 5th month...etc, I could not get the desired result by this:
can you help me.
for my second question: create dummy equal 1 for the 1st month 3rd month 5th month...etc, I could not get the desired result by this:
Code: Select all
smpl @all
series dum=0
smpl if @mod(@year,1)=0 and @mod(@month,3)<2
dum=1-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: generate dummy for weekday
Use the @month function.
Re: generate dummy for weekday
I have solved my case.
thanks for all your efforts :D
kind regards ecofin.
thanks for all your efforts :D
kind regards ecofin.
Who is online
Users browsing this forum: No registered users and 2 guests
