>
> I'm looking for a way to calculate the lower and
> upper bound for each point change.
>
> Thanks in advance!
the sophisticated subject seemed out of my range of knowledge, but..
it seems stataDM just seeks latest and earliest time values as an ID moves from one "point" to the next
That looks like an eaasy challenge for data step handling of retain and/or lag()/dif() functions and by-grouop processing, using a do loop with last.ID to collect info
For example :assuming "point" is numeric[pre]data changes ;
do /* loop over rows for an ID */ until( last.ID) ;
set stataDM.data ;
by ID ;
interval = dif( time) ;
if dif( point ) then /* have change in point */ do ;
if not first.ID then output ;
last_point= point ;
end ;
last_time= time ;
end ;
run ;[/pre]
The output will have an entry for each change of "point" for an ID with extra columns INTERVAL, LAST_POINT and LAST_TIME, which I think should provide what is needed.
Then in addition to what appeared to be asked for
> change. The changes I want to look at are 2 to 3, 3
> to 4, 4 to 5, 5 to 6, 6 to 7. I need the lower and
it will also provide that 45 interval for ID=2 where POINT changes from 2 to 4 indicated as expected output by this next piece of the original posting
> So for ID 2, I know that the time falls somewhere
> between 09:45 and 10:30 (45 minutes). The bounds
> would then be 1-45.