The code actually doesn't work so I will need to go back and edit.
Do loops do not exist in PROC SQL.
you could create a macro with a %DO loop and that should work in PROC SQL if you do it properly. However, since I really don't understand what you want to do (there are no columns A-E), I would need to understand the problem better in order to help.
Not sure what you mean by multiple columns. Show some simple example data and the expected results.
It is not clear what you are counting.
Don't you just want to use the MAX() aggregate function to test if the term ever matched?
...
,max(find(t1.col_name,t2.search_terms,'it') > 0) as any_match
group by ...
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.