Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Oddities with weekly data

From   "Austin Nichols" <>
To   "Michael S. Hanson" <>,
Subject   Re: st: Oddities with weekly data
Date   Fri, 19 May 2006 15:59:32 -0400

My approach (generating your own week variable, essentially, bypassing
the wofd() function) would solve the Mon/Tue problem and the week 52
problem, but assuming there are no missing weeks, your alternative of
using _n seems just as good or better.  The oddity of weeks is that
Stata constrains there to be only 52 weeks in a year, and the week
numbering starts over on Jan 1 of each year, which means that week 52
in any year is either 8 or 9 days long.  Having repeated time values
in a weekly time series is nearly inevitable given these definitional

range t 12040 12060 21
gen twk = wofd(t)
gen d=t
format d %d
li, noo sep(7)

On 5/18/06, Michael S. Hanson <> wrote:
As an alternative, I could just -tsset- with a simple time trend:

sort t
gen trend = _n
tsset trend

...but that has the disadvantage that the time variable doesn't have
any natural units;  thus one cannot use the -tin()- functions for
selecting subsamples, dates don't show up correct on the t-axis of
graphs, etc.

So I'm still a bit stuck -- something apparently is still "odd" with
these data -- but I do appreciate your help.  As I mentioned above, any
additional thoughts would be most welcome.  Thanks again.

                                        -- Mike
*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index