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

st: format & reshape time-of-day measures

From   Steven_A Harvey <>
Subject   st: format & reshape time-of-day measures
Date   Sun, 17 Aug 2003 00:59:08 -0400

I have a set of data from which I am interested in analyzing the time 
of day at which some key behaviors take place. The data was collected 
from weekly surveillance visits in two different waves over a period of 
15 weeks each.  The form is:
household (1-15)
week (1-14)
wave (1, 2)
hour (13:00 23:30)

I have two questions:  

1.  The data was originally entered in Access where the hour variable 
takes the form ##:##.  When I imported the data into Stata v. 8 using 
StatTransfer, Stata read the hour variable as a float and assigned it a 
display format of %8.0g.  The values are now decimals with a range 
of .125 to .979.  How can I get Stata to recognize these values as a 
time-of-day and display them as ##:##? 

2.  If I'm not mistaken, I then need to reshape the data from long to 
wide so that each household becomes a single case and each time-of-day 
measurement (wave 1, week 1-14 and wave 2, week 1-14) becomes a 
variable.  So I should end up with 24 measurements for each of 15 
cases, right?  (I currently have 368 "cases"--15 x 14 x 2 minus some 
losses to follow-up and some censored households--each consisting of 
the 4 variables above.)  How can I use the reshape commands given that 
I have two levels of time measurements (wave & week)? 

Many thanks in advance.


*   For searches and help try:

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