Statalist


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

Re: st: Week() Function


From   "Eric G. Wruck" <[email protected]>
To   [email protected]
Subject   Re: st: Week() Function
Date   Wed, 25 Jul 2007 16:55:21 -0400

Thanks, Brian -- that's what I was looking for.  And thanks, Nick, for the explanation.

EGW


>On Wed, 25 Jul 2007, Eric G. Wruck wrote:
>
>>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 |
>>    +---------------------+
>>
>
>Eric,
>
>I suspect you want to use the wofd() function instead:
>
>   . gen week2 = wofd(date2)
>   . format week2 %tw
>   . list date2 week2
>
>     +---------------------+
>     |     date2     week2 |
>     |---------------------|
>  1. | 16jul2007   2007w29 |
>  2. | 17jul2007   2007w29 |
>     +---------------------+
>
>
>Both those dates occurred in the 29th week of 2007.
>
>   -- Brian Poi
>      [email protected]


*
*   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