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
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.