Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

st: clock function accuracy

From   Emmanouil Mentzakis <>
Subject   st: clock function accuracy
Date   Wed, 22 Feb 2012 12:33:46 +0000


I am trying to convert some string dates to dates in Stata format but
I am having some difficulty with accuracy (probably is a problem of me
not understanding some details). When I convert and format, some dates
appear as expected but other don't. When observing the entries in the
editor all new dates have extra second added to them. Below is an
example. I would be grateful if anyone could help.

If I am trying to match datasets based on date/time do these extra
second matter?




input str16 date
"2002-01-01 02:00"
"2002-01-01 03:00"
"2002-01-01 06:00"
"2002-01-01 07:00"
"2002-01-01 08:00"

gen date2 double = clock(date, "YMDhm")
format date2 %tcDD-Mon-CCYY_HH:MM

gen newdate = date+":00.000"
gen date3 double = clock(newdate, "YMDhms")
format date3 %tcDD-Mon-CCYY_HH:MM
*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index