BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jade | Level 19

I had started to program a somewhat similar approach (starting with singletons, then pairs, triples, then I gave it up because it seemed to me that the number of combinations to check might grow too large -- depending on the data, though). I used the CALL ALLCOMBI routine rather than nested DO loops to create the combinations.


Not sure where the "potential of not getting everything assigned to a group" should come from: Since the original dataset has a total of zero, the leftover after taking away any proper subset with sum zero must have a total of zero as well. So, the worst case I could imagine was that at some point the remaining (not further decomposable) subset would be unnecessarily large.

Obsidian | Level 7

Everyone -THANK YOU.  I'm implementing and trying both the "brute force" and the "greedy" applications. I sincerely cannot thank the community enough for the help on this.  I was pulling my hair out trying to figure this out, so from the bottom of my grateful heart thank you.  

Tourmaline | Level 20

You can replace the pair search with something simpler.

data work.pairs ( keep=iout jout ival jval)
     work.leftover (keep=ba:)
   set work.trans end=last;
   array b ba:;
   do i= 1 to (dim(b)-1);
     if b[i]=. then continue;
     j=whichn(-b[i],of b[*]);
     if j=0 then continue;
     ival = b[i];
     jval = b[j];
     output work.pairs2
     call missing(b[i],b[j],iout,jout);
   if last then output work.leftover;

Not that it makes difference overall....



Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 17 replies
  • 8 in conversation