Add a RETAIN statement that resolves a SAS variable in your DATA step. In the statement, declare the macro variable in double-quotes as the variable value. Add an ATTRIB statement to document the variable.
Okay, then use the IN= parameter on the SET statement, and assign a concatenated string of subfield values (how about one char per input file), and use the "1" or "0" indicator from the IN= to detect when one of your input files (to the SET) is contributing an observation.
There is a SET statement option for this in V9.2 if you have less than 9.1.3 like me you can do something like....
data one two three four five;
x = 1;
select cats(memname,'(in=__',memname,')') into :codeGen separated by ' '
from dictionary.members where libname eq 'WORK';
%put NOTE: CODEGEN=&codegen;