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 ...
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.