What I want to do is to check all overlapping and create a new column to label each row. Like this:
Section | start time | end time | group Aaa | 01Jun2025:00:01:10 | 01Jun2025:00:09:02 | 1 Aaa | 01Jun2025:00:03:10 | 01Jun2025:00:12:00 | 2 (start time is earlier than previous end time, so label as 2) Aaa | 01Jun2025:00:10:09 | 01Jun2025:00:18:08 | 1 (start time is later than group 1 end time, so group 1 is released and can assign to this row) Bbb | 01Jun2025:00:01:02 | 01Jun2025:00:03:01 | 1 ( new section restart the calculation from group 1) Bbb | 01Jun2025:00:02:10 | 01Jun2025:00:09:08 |2 …
I tried to loop through all row, and record all “group” latest end time in macro variable. Then compare each row endtime with each variable. But it takes so slow.
Checking interval can be a bit tricky, but I don't this is an application for macro. Have the data set sorted by section and start time, do a data set by. Create two retained columns for start and end time, so you can compare those values with current star and end time on the next record - and based on that comparison set your label.
Data never sleeps
The 2025 SAS Hackathon Kicks Off on June 11!
Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.