Hi @TPayne,
I'm not sure about the expected result of your data step (note that variable SOURCE would be overwritten in every iteration of the DO loop), but maybe it's similar to what the data step below creates (or you can adapt this step accordingly):
data want;
array x[*] DTPSRC1-DTPSRC8 OPVSRC1-OPVSRC8 MMRSRC1-MMRSRC8 HIBSRC1-HIBSRC6 HBVSRC2-HBVSRC8
VAXSRC1-VAXSRC8 STPSRC1-STPSRC8 FLUSRC1-FLUSRC8 HAVSRC1-HAVSRC8 RTVSRC1-RTVSRC6;
set data.source_check3;
length source $10;
if n(of x[*])=0 then source="MISSING";
else if 1 in x & 0 ~in x then source="HD ONLY";
else if 0 in x & 1 ~in x then source="MED ONLY";
else source="BOTH";
run;
The logic used here: Variable SOURCE will be
"MISSING" if all 75 values are missing
"HD ONLY" if at least one of the values equals 1, but none equals 0
"MED ONLY" if at least one of the values equals 0, but none equals 1
"BOTH" in all other cases (i.e., if at least one of the values equals 0, and at least one equals 1 -- assuming that 0, 1 and . are the only possible values).
... View more