You cannot combine macro language (specifically your use of macro variables) with the PROC SQL code that is supposed to generate the macro variable values.
If you were to add:
OPTIONS SOURCE SOURCE2 MACROGEN SYMBOLGEN MLOGIC;
you would see the looping condition.
You need to separately generate the macro variable(s) containing your criteria upfront and then use the %DO / %END to loop through the pre-defined variable list.
Search the SAS support
http://support.sas.com/ website for using macro language to generate code.
Scott Barry
SBBWorks, Inc.