I have the following tables were subjects have overlapping date/time but i need to cut them by certain time to calculate different measures
have table. For example row 1 has a longer duration but row 2 has short. I need to assign row 2 start time as new stop time for row 1and create a row 3 that has row 1 as new stop dt but with row 2 stop dt time as new start time for row 3. It can have more than 2 observations.
patient | start_time | stop_time | value1 | value2 |
1 | 12/1/2019 0:00 | 12/1/19 22:12 | 1 | 4 |
1 | 12/1/2019 10:12 | 12/1/19 10:42 | 0.5 | 4 |
Want:
patient | start_time | stop_time | value1 | value2 |
1 | 12/1/2019 0:00 | 12/1/2019 10:12 | 1 | 4 |
1 | 12/1/2019 10:12 | 12/1/19 10:42 | 0.5 | 4 |
1 | 12/1/19 10:42 | 12/1/19 22:12 | 1 | 4 |
I have no idea how to start to be honest,
I tried _n = n + 1 for start_time < stop_date but i have no idea
do you expect any instances of more than 2 overlapping time-spans. Or is it always exactly 2? In other words, how far ahead do you need to look to determine all the needed start/stop pairs?
Thats a great question . it can be more than 2
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.