How many drugs have you got? If not too many, you can use a binary variable to mark each combination, e.g. data have;
infile cards truncover;
input id $4. line1_regimen $char80.;
cards;
0013 adali certoli hcq
001a certoli hcq etaner tofa goli
0034 adali inflix lef mtx
0054 adali hcq inflix mtx
;run;
data drugs;
set have;
length drug $10;
do _N_=1 to countw(line1_regimen,' ');
drug=scan(line1_regimen,_N_,' ');
output;
end;
keep drug;
run;
proc sql noprint; /* put quoted drug names in macro variable */
select distinct quote(strip(drug),'''') into :drugs separated by ' ' from drugs;
%let noof_drugs=&sqlobs; /* no. of drugs */
quit;
data simple complex;
set have;
length comb $&noof_drugs;
comb=repeat('0',&noof_drugs-1);
array drugs(&noof_drugs) $10 _temporary_ (&drugs);
do _N_=1 to countw(line1_regimen,' ');
substr(comb,whichc(scan(line1_regimen,_N_,' '),of drugs(*)),1)='1';
end;
if length(compress(comb,'0'))>2 then output complex;
else output simple;
run;
COMB will then mark which unique drugs are present in each regimen. ('1' in position 1 means that drug no. 1 is present, '0' means that it is not, etc.)
... View more