For example please find the below data:
account | balance |
---|---|
9999 | 110 |
9998 | 111 |
9997 | 112 |
9996 | 113 |
9995 | 114 |
9994 | 115 |
9993 | 116 |
9992 | 117 |
9991 | 118 |
9990 | 119 |
The output should be in such a way that there are 5 rows in Table_A and 5 Rows in Table_B and sum of balance column should almost be similar.
Want the output in SAS or PROC SQL.
I tried many ways in proc sql but not able to generate an output
Here is a base SAS solution.
You can sort by
balance
then output odd rows to one data set and even rows to the other. This should ensure that they have roughly equal number of observations, and the sum of balance should be as equal as possible.