I see no bug. -week()- tells you the week
of the year, and 16 July was in week 30
of 2007.
However, -week()- does not yield a date
in weeks. If you -format- as if it were
a date in weeks, then you get the result
that it was in 1960, as Stata starts
dates on 1 January 1960.
You don't say what you expected, but
I suspect you want a quite different function.
Nick
[email protected]
Eric G. Wruck
> I was trying to use the week function to graph weekly totals.
> However, I get some squirrelly results. Am I doing something wrong
> or have I uncovered a bug?
>
>
> . gen week = week(date2)
>
> . format week %tw
>
> . l date2 week
>
> +---------------------+
> | date2 week |
> |---------------------|
> 1. | 16jul2007 1960w30 |
> 2. | 17jul2007 1960w30 |
> +---------------------+
>
*
* 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/