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 |
+----------------------+
Happy New year
Svend
________________________________________________________
Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000 Aarhus C, Denmark
Phone, work: +45 8942 6090
Phone, home: +45 8693 7796
Fax: +45 8613 1580
E-mail: [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/