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

st: hours and minutes help


From   "SURAN, LUCIANA" <LSURAN@popcouncil.org>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: hours and minutes help
Date   Mon, 1 Dec 2003 12:20:20 -0500

Dear Statalist,

I was wondering if any of you know of a method for creating 2 new variables from 1 variable, with 1 of the new variables containing whole numbers and the second new variable containing the numbers after a decimal point.

I am asking this because I have time data (hours: minutes) in which the hours and minutes are separated by a decimal point instead of a colon (so 6:45 AM is expressed as 6.45, not 6.75). 

I have 2 variables: starttime and endtime. I need to subtract start-times from the end-times, which I cannot due with the present variable format.  I was thinking of using the "hmm" function that is part of the -egenmore- package.  But I need to separate the hours and minutes and this is where I get stuck.

I would greatly appreciate any advice you could give me.

--Luciana

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index