Page 1 of 1

Finding specific day of month

Posted: Tue Aug 17, 2010 12:17 pm
by jthodge
I have a monthly workfile and need to determine the date representing the first Thursday for each observation month.

Can anyone figure out a formula for creating this series?

genr first_thurs = ???

Code: Select all

obs first_thurs 2009M01 1/1/2009 2009M02 2/5/2009 2009M03 3/5/2009 2009M04 4/2/2009 2009M05 5/7/2009 2009M06 6/4/2009 2009M07 7/2/2009 2009M08 8/6/2009 2009M09 9/3/2009 2009M10 10/1/2009 2009M11 11/5/2009 2009M12 12/3/2009

Finding specific day of month

Posted: Tue Aug 17, 2010 12:28 pm
by EViews Gareth
This is from the top of my head on my phone, but something like:

Code: Select all

smpl if @weekday=5 and @month<>@month(-1) Series firstthurs = @datestr(@date,"yyyy/mm/dd") Smpl @all

Finding specific day of month

Posted: Tue Aug 17, 2010 12:30 pm
by EViews Gareth
Wait, you said monthly workfile, so my above solution won't work. I'll come up with something after lunch

Re: Finding specific day of month

Posted: Tue Aug 17, 2010 1:41 pm
by EViews Chris
I think this will do what you want:

Code: Select all

series first_thurs = @date + @recode(@weekday > 4, 11 - @weekday, 4 - @weekday)