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

st: Re: what time is it?

From   baum <>
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:


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


replace daystamp=daystamp+3653


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.

Christopher F Baum, Boston College Economics, Chestnut Hill MA 02467 USA
* For searches and help try:

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