Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: what time is it?


From   baum <[email protected]>
To   [email protected]
Subject   st: Re: what time is it?
Date   Fri, 27 Sep 2002 08:34:14 -0400

--On Friday, September 27, 2002 2:33 -0400 Jesper wrote:

Karim,

unless I am mssing something, you just need to convert it into days since
Jan 1 1960, and then use Stata's date functions.

gen daystamp=timestamp/(24*60*60)

- -- daystamp is now days since 1/1/1970.

now compute the n of days between 1/1/1960 and 1/1/1970.


. di date("1/1/1970","mdy")
3653

so

replace daystamp=daystamp+3653

and

format daystamp %d

I believe that what Karim and Liz Allred are asking for is the ability to have the granularity of time in HH:MM:SS, as is present in the *nix timestamp. Your solution has a maximal resolution of one day. What if we need to know whether the patient took the drug at 0802 or 1617 that day? Given Stata's medical orientation and the use of time-of-day in experimental data, it surprises me that this omission has not been addressed.

Kit
________________________________________________________________________
Christopher F Baum, Boston College Economics, Chestnut Hill MA 02467 USA
[email protected] http://fmwww.bc.edu/ec-v/baum.fac.html
*
* 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