As a third and I hope final comment, you
could clearly also go
gen endtime2 = floor(endtime) + 100 * (endtime - floor(endtime)) / 60
My bias here is to regard the -mod(,)- function as so useful
(and so often neglected) that I sometimes use it even when there is
a more direct solution.
For -floor()- read also -int()- so long as all your times
are zero or positive (but not if any is negative).
Nick
[email protected]
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Nick Cox
> Sent: 01 December 2003 18:00
> To: [email protected]
> Subject: st: RE: RE: hours and minutes help
>
>
> Correction
>
> > gen endtime2 = floor(endtime) + 100 * mod(endtime,1) / 60
> > gen starttime2 = floor(starttime) + 100 * mod(starttime,1) / 60
>
> Nick
> [email protected]
>
> > -----Original Message-----
> > From: [email protected]
> > [mailto:[email protected]]On Behalf Of Nick Cox
> > Sent: 01 December 2003 17:52
> > To: [email protected]
> > Subject: st: RE: hours and minutes help
> >
> >
> > I wouldn't use -egenmore- here, as
> > an attack from first principles is more direct.
> >
> > gen endtime2 = floor(endtime) + mod(endtime,1) / 60
> > gen starttime2 = floor(starttime) + mod(starttime,1) / 60
> > gen lapse = endtime2 - starttime2
> >
> > 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/
*
* 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/