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

st: RE: RE: Time calculations (Harvard correction)


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: Time calculations (Harvard correction)
Date   Wed, 20 Nov 2002 22:34:27 -0000

Jawad A. Al-Lawati
>  
> > I have two variable T1 (fasting time the night before 
> > glucose test is done
> > expressed as airport time e.g 22.00) and variable  T2 (time 
> > when patients
> > blood was tested for diabetes expressed as airport time but 
> > was collected in
> > the morning so does not matter if airport time is expressed 
> > but it is in the
> > format of 9.00).
> > 
> > Question: How do I calculate the time difference if between 
> > the previous
> > evening (when patients fasted and the next mooring when 
> > patients were
> > tested)
> > 
> 
> gen diff = T2 + (24 - T1) 
> 
> 
> Nick 

Marcello Pagano points out that there is 
a tacit assumption here that everyone went to 
bed before or at midnight. So, 

gen paganodiff = T2  - T1 + cond(T1 >= 12, 24, 0)  

Nick 
[email protected] 
*
*   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