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: clock function accuracy


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

Hello,

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?

Thanks
Manos


***Example

clear*

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"
end

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

gen newdate = date+":00.000"
gen date3 double = clock(newdate, "YMDhms")
format date3 %tcDD-Mon-CCYY_HH:MM
list
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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