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 at the end of May, and its replacement, statalist.org is already up and running.


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

st: clock function accuracy


From   Emmanouil Mentzakis <ementzakis@gmail.com>
To   statalist@hsphsun2.harvard.edu
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index