Dear Joe,
You can use the substr function to extract the date and time into separate string variables.
Use ssc install catenate
then you can construct a new datetime variable such as mydt = catenate datestr + timestr)
Then use transform this into a Stata date time function with gen double statadt = clock(mydt, "YMD hms")
Then format this with the new format statdt %tc
You will have solved your problem.
Regards,
Bob Yaffee
Robert A. Yaffee, Ph.D.
Research Professor
Shirley M. Ehrenkranz
School of Social Work
New York University
home address:
Apt 19-W
2100 Linwood Ave.
Fort Lee, NJ
07024-3171
Phone: 201-242-3824
Fax: 201-242-3825
[email protected]
homepage: http://homepages.nyu.edu/~ray1/
----- Original Message -----
From: Joseph Coveney <[email protected]>
Date: Wednesday, August 22, 2007 11:20 am
Subject: st: ISO 8601 date-time format in Stata 10
To: Statalist <[email protected]>
> Could someone show what the format statement is in order to get the
> following date-time format for a double-precision variable containing
> a
> timestamp?
>
> 2007-08-22T23:54:00
>
> I've read the help file for dates and times, but am unable to use the
> new
> syntax correctly.
>
> Joseph Coveney
>
>
> *
> * 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/
*
* 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/