Statalist


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

st: Transforming a decimal number into hours and minutes


From   Peer Skov <peer_skov@hotmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Transforming a decimal number into hours and minutes
Date   Fri, 7 Aug 2009 10:54:17 +0000

Hi listers,
I am working with a survey dataset. The individuals have all been asked to report how much time they have spent on a specific activity. The answers are recorded in the dataset as a numeric variable the provided answers are integers (hours worked). 
I want to assign conditional means to the individuals who have not answered the hour question. Calculating the means leads to a decimal number and therefore I need to transform the decimal-part into minutes. Since Statas date function only work with strings and a decimal number cannot be turned in to a string I am not sure how I can solve it.
 
Code:
bysort edu: egen hoursA=mean(hours)
replace hours=hoursA if hours ==. & active == 1
 
Example.
I need to turn 3.89 into 3.53
 
All thoughts are much appreciated.
Best,
Peer.
_________________________________________________________________
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

http://www.microsoft.com/windows/windowslive/products/photos.aspx
*
*   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   |   What's new   |   Site index