Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Time/Date query


From   Christopher J Gerry <[email protected]>
To   [email protected]
Subject   st: Time/Date query
Date   Wed, 27 Jun 2007 10:06:00 +0100

I have a query regarding transforming a date read into Stata as a string
variable which I need to translate into a numeric variable (and then store
in Stata's %tc format). I'd be grateful if anyone has any idea what I'm
doing wrong. It falls over when I use the -clock- function. But after studying
the help pages am still not sure why! The error message is r(133) "Unknown
function clock()".

My code:
------
clear
set obs 1
ge str23 stringdate = "2001-02-31 11:12:13.000"
l
ge double mydate = clock(stringdate, "YMD hms") Format mydate %tc
------

The line generating mydate produces the error message.

I have read Stata's help page for dates and times at:

 http://www.stata.com/help.cgi?dates_and_times#description

And off this page is a page for help with "String to numberic translation
functions":

 http://www.stata.com/help.cgi?dates_and_times#str2num

Which contains an example identical to mine above.

I am using Intercooled Stata v9.2.

Thanks in advance!

Chris

-- 
Dr. Christopher J Gerry
Lecturer in European Economics
Programme Director IMESS
UCL School of Slavonic and East European Studies
16, Taviton Street, London
Tel: + 44 (0)207 679 8759; Fax: +44 (0)207 679 8777
http://www.homepages.ucl.ac.uk/~tjmscge/
http://www.imess.eu




*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index