Statalist


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

st: RE: Week() Function


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Week() Function
Date   Wed, 25 Jul 2007 20:25:24 +0100

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/



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