Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: converting a string into a date


From   Nick Cox <njc@stata.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: converting a string into a date
Date   Mon, 30 Aug 2004 08:32:15 -0500

Fabrizio Stracci

I have a large file containing a date of birth variable coded "ddmmyyyy"
without any separator. User's manual on page 306 suggests a solution for a
similar case. However there should be some way to insert characters at a
fixed position into a string (i.e. a "/" after the second and the fourth
character) or to generate three new substrings containing day, month, and
year respectively again based on the fixed position of day, month, and year
in the string... probably I just overlooked it. Many thanks for your help.
There is a FAQ on this question at
http://www.stata.com/support/faqs/data/dateseq.html

Among other solutions, a dedicated program -todate- is available
at SSC.

. ssc inst todate
. whelp todate

Nick

njc@stata.com
(visiting StataCorp)
*
* 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index