I would like to point out what I think is a glitch in stata regarding the
-week- function. In my data, two dates that are a week apart were assigned
to the same week by stata's -week- function. My code runs as follows:
. gen year=year(date)
. gen week=week(date)
. gen wk=yw(year,week)
. format wk %tw
. tsset wk, w
repeated time values in sample
r(451);
further inspection reveals that (part of) my data looks like:
date year week wk
09dec1996 1996 50 1996w50
16dec1996 1996 51 1996w51
23dec1996 1996 52 1996w52
30dec1996 1996 52 1996w52
06jan1997 1997 1 1997w1
ie, stata has assigned two dates that are a week apart to the same week.
The range of the week function is 1 to 52, however, maybe it ought to be 1
to 53 to avoid this issue? Or maybe the first week of the year should start
on the monday prior to the turn of the year? eg Monday 26/12/1996 = first
day of week 1, 1997, etc. Or alternatively, Monday 3/1/1997 = first day of
week 1, 1997 and Sunday 2/1/1997 = last day of week 52, 1996.
Maybe someone could suggest an alternative (better) code than mine given the
way stata currently is? I have corrected my data manually so that the first
week of the year starts on the monday prior to the turn of the year.
However, this was longwinded.
Best regards,
Paul Metcalfe
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/