Thanks to Svend for the nice plug. -todate- does what
it aims to do, but it's not going to become an official
Stata command in any foreseeable universe. What
is needed in this territory is a function or functions
(strict sense, i.e. _not_ a program)
for run-together dates which can be applied to individual
dates as well as date variables. At present, the closest users
can get to that is to write a Mata function.
Nick
[email protected]
Svend Juul
> Michael wrote:
>
> I have a date string which I'd like to convert to Stata date.
>
> . list datedx in 1/5
> +----------+
> | datedx |
> |----------|
> 1. | 19900417 |
> 2. | 19880107 |
> 3. | 19930407 |
> 4. | 19880819 |
> 5. | 19880927 |
> +----------+
>
> How is that done?
> -------------------------------------------------------------------
> There were suggestions. However, as so often before,
> Nick Cox has made a nice solution, -todate-. It
> deserves to be official, but isn't (yet). Install
> it by:
> ssc install todate
>
> With Michael's five observations :
>
> todate datedx , gen(datedx2) pattern(yyyymmdd)
> format datedx2 %d
> list
> +----------------------+
> | datedx datedx2 |
> |----------------------|
> 1. | 19900417 17apr1990 |
> 2. | 19880107 07jan1988 |
> 3. | 19930407 07apr1993 |
> 4. | 19880819 19aug1988 |
> 5. | 19880927 27sep1988 |
> +----------------------+
>
*
* 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/