I want to run several models (which I don't need help with) looking at the time it takes for the points to change. Since we do not know the exact time, I want to use interval censoring. Therefore, my goal is the get the possible lower and upper time points for each 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 upper possible time ranges for each of these changes. The time ranges will be the least possible time it took to change from 2 to 3 and the most possible time it took to change from 2 to 3 (in minutes).
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.
I'm looking for a way to calculate the lower and upper bound for each point change.
> 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 ;
last_time= time ;
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.
So what I actually need to get using sample id 2, if I want to calculate the min and max time to go from 4 to 5 it would take [60-120] to get to 4 and [120-180] to get to 5. So, the minimum time would be 120-120=0 and maximum would be 180-60=120. My lower bound would be 0 and the upper bound would be 120.
Any thoughts on how to calculate this for each interval in SAS?
The SAS programming fundamentals are pertinent which you can use and still relate to your objective, I would say - FIRST. and likely LAST. to correlate related SAS variable values, capturing TIME and then deriving a interval time measurement.