Statalist The Stata Listserver


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

Re: st: 3 methods for converting a string date to Stata format


From   "David Elliott" <[email protected]>
To   [email protected]
Subject   Re: st: 3 methods for converting a string date to Stata format
Date   Thu, 4 Jan 2007 00:13:35 -0400

And don't forget:

*Method 4
. gen edate=mdy(real(substr(datedx,5,2)),real(substr(datedx,7,2)),real(substr(datedx,1,4)))
. format %-d edate
. list

	datedx   edate
	----------------------
1.	19900417   17apr1990
2.	19880107   07jan1988
3.	19930407   07apr1993
4.	19880819   19aug1988
5.	19890127   27jan1989

(and check your substring arguments)
*
*   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