I can see two methods to fix this.
One is to first collapse your A intervals so that they do represent separate intervals. Then loop over them and check if B falls in any of them.
The other is to brute force it. Make a large temporary array with one element for each possible day. Process the A records to fill in the days each covers. Then loop of the days of the B interval and see if all of the days are covered.
I think about collapse the intervals of A into only one interval of A (if they are overlap), so now I'm trying to do it, although there are some problems (because there are more conditions for A and B), but that's the only way I can do right now.
For your second solution, I don't really understand it.
Thank you for helping me hihi
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.