weekly dummy for 1st&2nd

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

clubmed
Posts: 81
Joined: Sun Nov 30, 2014 3:03 am

weekly dummy for 1st&2nd

Postby clubmed » Fri Apr 29, 2016 2:14 am

hi
i want to estimate effect of weekly in my data (frequency weekly). by this code "series d1= @day=@minsby(@day,@datefloor(@date, "m"))" it generate dummy for the first week of every month. how can modify the code to make dummy like this:
1-generate dummy for the first and second week for every month
2-generate dymmy just for the second week for every month.

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

Re: weekly dummy for 1st&2nd

Postby EViews Gareth » Fri Apr 29, 2016 6:26 am

How are you defining the first and second week of the month?

clubmed
Posts: 81
Joined: Sun Nov 30, 2014 3:03 am

Re: weekly dummy for 1st&2nd

Postby clubmed » Fri Apr 29, 2016 7:14 am

first Sat 08/02/1991 and the second Fri 15/02/1991

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

Re: weekly dummy for 1st&2nd

Postby EViews Gareth » Fri Apr 29, 2016 7:15 am

I don't understand that.

clubmed
Posts: 81
Joined: Sun Nov 30, 2014 3:03 am

Re: weekly dummy for 1st&2nd

Postby clubmed » Fri Apr 29, 2016 7:18 am

sorry,
i have not the first week for the first month for my data because it start by the second week 08/02/1991 for the Feb month, but the others month start by the first week.
Attachments
wgfupus2w.wf1
(35.77 KiB) Downloaded 389 times

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

Re: weekly dummy for 1st&2nd

Postby EViews Gareth » Fri Apr 29, 2016 7:57 am

That still doesn't make sense. What is the first week of a month? The first week in which any day of the week occurs within the month? The first week in which the Monday is in the month? The first week in which the Sunday is in the week? etc...

clubmed
Posts: 81
Joined: Sun Nov 30, 2014 3:03 am

Re: weekly dummy for 1st&2nd

Postby clubmed » Fri Apr 29, 2016 8:16 am

Friday :oops: , how can generate dummy for my two case

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

Re: weekly dummy for 1st&2nd

Postby EViews Gareth » Fri Apr 29, 2016 8:30 am

In your workfile's case it is easy:

Code: Select all

(@month<>@month(-1) or @month<>@month(-2))

clubmed
Posts: 81
Joined: Sun Nov 30, 2014 3:03 am

Re: weekly dummy for 1st&2nd

Postby clubmed » Fri Apr 29, 2016 9:07 am

but when i use this code
first case: first & second week take 1 for every month

Code: Select all

series d1= @recode((@month<>@month(-1) or @month<>@month(-2)),1,0)
the 08/02/1991 should take 1 not "na" value
second case: second week take 1 for every month

Code: Select all

series d1= @recode(@month(-1)<>@month(-2),1,0)
the 08/02/1991 should take 1 not "na" value

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

Re: weekly dummy for 1st&2nd

Postby EViews Gareth » Fri Apr 29, 2016 9:16 am

I'm sure you can figure out how to fix the first observations.

clubmed
Posts: 81
Joined: Sun Nov 30, 2014 3:03 am

Re: weekly dummy for 1st&2nd

Postby clubmed » Fri Apr 29, 2016 9:20 am

Got it!, Edit
thank you very much for your help :)


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests