Hi,
I have a data set look like below:
district number
d1 10000
d2 1000
d3 500
d4 1002
d5 700
d6 10070
d7 5
d8 9800
I want to sum possible districts where the total number is close to 11077. For example, the sum of d1 and d2 is 11000 and it's close to 11077. Same thing for d4, d6, and d7 (their total is 11077). It doesn't need to be only two districts, it can be more than two. The only things I need are all districts should have a flag number and the total should be close to 11070. I have 70 districts in my data set.
district number flag
d1 10000 1
d2 1000 1
d3 500 2
d4 1002 3
d5 700 2
d6 10070 3
d7 5 3
d8 9800 2
Thanks for any comment and help!
... View more