Hey Rick, The only thing I've experimented with so far is a solution you provided on this forum a few years ago to a similar question. Code is below: proc iml; items = {0, 4, 12, 18, 20, 26, 27, 29, 33, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 52, 60, 65, 78}; target = 505; N = nrow(items); do k = 1 to N; a = allcomb(N, k); /* all combs taken k at a time */ m = shape(items[a], 0, k); /* make matrix with k rows */ idx = loc(m[,+] = target); /* rows whose sum = target */ if ncol(idx)>0 then print (m[idx,]); end; The difference is, the items list above is a single subset. I need something more like this with the above target: list1 = {0, 47}; list2 = {0, 45}; list3 = {0, 49}; list4 = {0, 42, 60}; list5 = {0, 44}; list6 = {0, 26, 44}; list7 = {0, 52, 65, 78}; list8 = {0, 4, 12, 20, 27, 38}; list9 = {0, 46}; list10 = {0, 18, 33, 40, 42}; list11 = {0, 29, 39}; list12 = {0, 41, 48}; Also, this line: if ncol(idx)>0 would need to be changed because ncol = 12 every time.
... View more