Hi
For a given period, for example 1/1/2014 to 12/31/2014, I would like to create a string for the date of the third Wednesday every month (i.e. the date between the 15th and 21st , whichever such day is a Wednesday).
I.e. the string should, in this example, create 12 dates, 1/15/2014, 2/12//2014, and so on.
I'm not sure how i should start and what functions I should use.
Regards Johan
Find a special day each month
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
johansamuelsson
- Posts: 165
- Joined: Thu Mar 03, 2011 10:07 pm
- Contact:
-
EViews Chris
- EViews Developer
- Posts: 161
- Joined: Wed Sep 17, 2008 10:39 am
Re: Find a special day each month
Here's one approach. First calculate the first Wednesday in each month:
Then add on two weeks to get to the third wednesday:
I'm taking a bit of a shortcut here by adding on days to dates by simple addition rather than using @dateadd().
Code: Select all
series firstwed = @recode(@weekday>3, @date+(10-@weekday), @date+(3-@weekday))Code: Select all
show @datestr(firstwed + 14, "Weekday Month day year")-
johansamuelsson
- Posts: 165
- Joined: Thu Mar 03, 2011 10:07 pm
- Contact:
Who is online
Users browsing this forum: No registered users and 1 guest
