I guess at least a few people may be confused by this thread.
The problem is _not_ the order of the elements month, day,
year, as Stata's -date()- function is capable of handling
various orders. The issue is Stata's assumption that
the dates come with separators. Rodrigo's examples show
his problem better than his notation, which includes separators.
In my experience, dates without separators (run-together
dates) are fairly common. I have heard some individuals comment
that in particular fields they are actually the norm!
-todate- has been a work-around lurking on SSC since 2001
while StataCorp gets round to supporting them.
Several FAQs discuss dates. This may be the one that Rodrigo
alludes to:
http://www.stata.com/support/faqs/data/dateseq.html
Nick
[email protected]
Rodrigo Briceno wrote:
> > Dear statalisters. I reviewed the FAQ about how to handle
> dates and I
> > discovered some interesting functions to deal with dates. I
> have a little
> > problem with the dates I have, because the order of
> mm-dd-yy is not present.
> > My dates are dd-mm-yy. I downloaded the "todate" program,
> and I was capable
> > to convert the dates in several files that I have, but
> other files has this
> > different structure. Does anyone knows how to handle with
> this feature?
> >
>
> -todate- should do it. Look at the help file a little more carefully.
>
> -todate- doesn't require mm-dd-yy order. In fact, it
> requires that you specify
> the order with the pattern option. in your case, ddmmyyyy, i.e.
>
> todate adm_date dis_date, p(ddmmyyyy) gen(adm_date2 dis_date2)
>
*
* 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/