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/