generate dummy for weekday

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

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

Re: generate dummy for weekday

Postby ecofin » Thu Oct 09, 2014 9:26 am

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.

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

Re: generate dummy for weekday

Postby ecofin » Fri Oct 10, 2014 4:56 am

any idea for my new case :roll:
thanks in advance.
Attachments
pic_2.png
pic_2.png (75.97 KiB) Viewed 8169 times

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

Re: generate dummy for weekday

Postby EViews Gareth » Fri Oct 10, 2014 7:30 am

I don't understand the question. 08-01-1990 was a Monday.

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

Re: generate dummy for weekday

Postby ecofin » Fri Oct 10, 2014 7:40 am

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.

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

Re: generate dummy for weekday

Postby startz » Fri Oct 10, 2014 7:50 am

Code: Select all

series newdummy = 1 - olddummy
?

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

Re: generate dummy for weekday

Postby ecofin » Fri Oct 10, 2014 10:17 am

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.

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

Re: generate dummy for weekday

Postby EViews Gareth » Fri Oct 10, 2014 10:23 am

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.

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

Re: generate dummy for weekday

Postby ecofin » Fri Oct 10, 2014 10:33 am

i see, how can change the code to make last week of every months eqaul 0.

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

Re: generate dummy for weekday

Postby EViews Gareth » Fri Oct 10, 2014 3:47 pm

Could you fully specify what you're after?

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

Re: generate dummy for weekday

Postby ecofin » Sat Oct 11, 2014 6:37 am

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

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

Re: generate dummy for weekday

Postby EViews Gareth » Sat Oct 11, 2014 1:49 pm

Code: Select all

series dum = @date >= @datefloor(@date,"month") + 7 and @enddate+1<@dateadd(@datefloor(@date,"month"),1,"month")

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

Re: generate dummy for weekday

Postby ecofin » Tue Oct 14, 2014 6:37 am

thanks! for your help :D


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests