I believe all this. My problem was reading Caleb's post literally.
But note that -int()- is dangerous with dates. -int()- rounds
towards zero, and thus does different things
either side of the time origin. This won't bite
you here because your origin, the notional year 0,
is way outside the likely data, but in general -floor()- is better,
especially with Stata's date origin and dates <= 1959.
Nick
[email protected]
Austin Nichols
> clear
> input double event1
> 1932.288
> 1960.0044
> end
> gen y=floor(ev)
> gen yl=doy(mdy(12,31,y))
> gen d=int((ev-y)*yl)+1
> gen nd= mdy(1,1,y)+d-1
> format nd %d
> l, noo clean
>
> My advice about ignoring all the above and instead using the obs# as
> the variable in -tsset obs- stands, however. In particular, I don't
> believe that 1932.288 is intended to represent April 15, 1932 at
> 9:47:31am, but instead someone took April 14, turned that into the
> 105th day of the year (where 1/1 is the first day) and then divided
> 105 by 365 and rounded to .288, which set of operations is not
> everywhere invertible. To merely preserve order, I reiterate:
>
> sort event1
> gen obs=_n
> tsset obs