Page 2 of 2
Re: generate dummy for weekday
Posted: Thu Oct 09, 2014 9:26 am
by ecofin
is the weeks start on a Tuesday 08-01-1990 the code would be
Code: Select all
series first = @date>=@datefloor(@date,"month")+7
i would like that the last week of every month take 0.
Re: generate dummy for weekday
Posted: Fri Oct 10, 2014 4:56 am
by ecofin
any idea for my new case

thanks in advance.
Re: generate dummy for weekday
Posted: Fri Oct 10, 2014 7:30 am
by EViews Gareth
I don't understand the question. 08-01-1990 was a Monday.
Re: generate dummy for weekday
Posted: Fri Oct 10, 2014 7:40 am
by ecofin
in my first case the first and last week equal 1 for every months, i would like to reverse my first case.
the first and last week for every months eqaul 0, the others weeks take 1.
you understood me.
Re: generate dummy for weekday
Posted: Fri Oct 10, 2014 7:50 am
by startz
Re: generate dummy for weekday
Posted: Fri Oct 10, 2014 10:17 am
by ecofin
i Know Mr startz this is the short way thanks!..., but i would to understood the logic of the code (long way code) when i chose for example Tuesday 08/01/1990 the first week or other weeks.
the part of code:
Code: Select all
series first = @date>=@datefloor(@date,"month")+7....
i hope you understood me. if you have any idea Mr startz or Mr Gareth.
your help will be very useful for me.
Re: generate dummy for weekday
Posted: Fri Oct 10, 2014 10:23 am
by EViews Gareth
Code: Select all
series first = @date>=@datefloor(@date,"month")+7
This creates a dummy variable equal to 1 whenever the date of an observation is greater than or equal to the date of the 8th day of the month (@datefloor(@date, "month") is the date of the first date of the month, and +7 makes it the 8th.
Re: generate dummy for weekday
Posted: Fri Oct 10, 2014 10:33 am
by ecofin
i see, how can change the code to make last week of every months eqaul 0.
Re: generate dummy for weekday
Posted: Fri Oct 10, 2014 3:47 pm
by EViews Gareth
Could you fully specify what you're after?
Re: generate dummy for weekday
Posted: Sat Oct 11, 2014 6:37 am
by ecofin
suppose my first question was in this topic:
create dummy equal 0 for the first and last week for every months, and others weeks equal 1 (week start on a Monday 08-01-1990)
08/01/1990 to 22/01/1990 =1
12/02/1990 to 19/02/1990 =1
12/03/1990 to 19/03/1990 =1
09/04/1990 to 23/04/1990 =1
.
.
.
etc
how can generate dummy?
you understood me now
Re: generate dummy for weekday
Posted: Sat Oct 11, 2014 1:49 pm
by EViews Gareth
Code: Select all
series dum = @date >= @datefloor(@date,"month") + 7 and @enddate+1<@dateadd(@datefloor(@date,"month"),1,"month")
Re: generate dummy for weekday
Posted: Tue Oct 14, 2014 6:37 am
by ecofin
thanks! for your help :D