Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Question on converting time-variable


From   Simon Falck <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: Question on converting time-variable
Date   Tue, 01 Oct 2013 10:55:26 +0200

Dear Statalist,

Working with Stata 11.2, I want to convert two string variables (start, stop) with time information showing year-month-day-hour-minutes, e.g. "1998 10 19 1000" to time-format so "01oct1998 10:00:00", which can easily done by,

gen double starttime=clock(start, "YMDhm")
format starttime %tc

However, it appears that my timevariables (strings), i.e. the strings, sometimes indicate midnight as 2400, e.g. "2004 12 13 2400" and sometime as 0000, e.g. "1999 10 26 0000", and Stata seems only to accept the latter, implying that observations that indicate midnight as "2400" are not converted.

My question how to convert observations that indicate midnight as 2400 to 0000 in the string variable(s), or to time variable(s)?

Thanks in advance,
Simon

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index