There are some circumstances of 3 and 4 compounds, so they are not always only 2. I made some tweaks to your code which account for that and they seemed to work! Everything worked! This is so great, thank you. data alldrugs06; set alldrugs05; array d (*) drug1-drug18; array c (18); /* helper array of indicators of COMPOUND values*/ do i=1 to dim(d); c[i] = (findc(d[i],'/')>0); end; /* temp variables to hold pieces of the compound*/ length temp1 temp2 temp3 temp4 $ 40; /* see if any of the array elements are compounds*/ comp= whichn(1,of c(*)); if comp>0 then do until (comp=0); /*get the individual components of the compounds*/ temp1=scan(d[comp],1,'/'); temp2=scan(d[comp],2,'/'); temp3=scan(d[comp],3,'/'); temp4=scan(d[comp],4,'/'); do i=1 to dim(d); if d[i]=temp1 then call missing(d[i]); if d[i]=temp2 then call missing(d[i]); if d[i]=temp3 then call missing(d[i]); if d[i]=temp4 then call missing(d[i]); end; /* remove the indicator for the processed compound from the helper array*/ c[comp]=0; /* see if there is another compound*/ comp= whichn(1,of c(*)); end; /* remove temporary variables*/ drop i temp1 temp2 temp3 temp4 c1-c18 comp; run; Spelling and case is not an issue as those have been addressed and standardized in previous QA work. And the compound are always indicated with a '/'. I see now the importance of including a data step when asking for help. I am still new to the community board but will be sure to include in future questions 🙂 Much thanks! -M
... View more