The bottom line is that you need to have valid working SAS code when the macro variables are resolved, otherwise your code with macro variables won't produce SAS code that runs.
Boolean comparisons such as you are trying to do require this syntax:
where (var1 in ('x','y','z')) or (var2 in ('x','y','z'));
and do not work (invalid syntax) like this:
where var1 or var2 in ('x','y','z'));
So your SAS code will not work.
ADVICE: Before you try to make things into a macro or use macro variables, produce code that works in SAS for a limited (but similar) problem (as above) with no macros and no macro variables. Once you have code that works, then you can begin the process of turning it into macros and/or macro variables.
Now, for your actual problem, let's suppose the problem is a bit simpler, you have only two possible diagnosis variables, and these are pdiag1 and pdiag10. The following code works:
data take_famplan;
set medclaims;
where (pdiag1 in (&DiagCode)) or (pdiag10 in (&DiagCode)) ;
run;
because it produces valid SAS code. So you'd have to fit your 21 diagnostic variables and 11 procedure variables into that syntax. It is also possible to write an actual SAS macro to do this, but that might take more time than simply brute force typing the variable names as above; or use hash tables to achieve what you want (but that's not something I can help with).
Lastly, just to clear up your terminology here for greater clarity, you have not created two macros. You have created two macro variables. Macros are not macro variables.
--
Paige Miller