Hi all I would need some help in writing a program to automate these steps: 1) Group client according to start & end time (if they overlapped, they will be group together) and the room number 2) Flag out the clients if their total sum of 'Est amount' is +/-$5000 - these could be of any combination within the group Below is a set of sample data and the outcome i would like to achieve. Thanks. Original Data client_id Est amount Max Play Avg. Play in_date out_date Start Time End Time timeplayed Room Number P1 33000 20000 5000 3/7/2012 3/7/2012 4:17:00 PM 6:34:00 PM 137 4444 P2 -30000 7000 2000 3/7/2012 3/7/2012 4:31:00 PM 6:16:00 PM 105 4444 P1 -233000 30000 15000 3/7/2012 3/7/2012 6:34:00 PM 7:55:00 PM 81 4444 P3 -50000 50000 50000 3/7/2012 3/7/2012 6:59:00 PM 7:00:00 PM 1 4444 P1 -47000 20000 10000 3/7/2012 3/7/2012 9:05:00 PM 9:48:00 PM 43 6789 P2 42000 25000 10000 3/7/2012 3/7/2012 9:24:00 PM 10:49:00 PM 85 6789 P4 8000 21000 8000 3/7/2012 3/7/2012 9:38:00 PM 10:55:00 PM 77 6789 Step 1 client_id Est amount Max Play Avg. Play in_date out_date Start Time End Time timeplayed Room Number Group 1 P1 33000 20000 5000 3/7/2012 3/7/2012 4:17:00 PM 6:34:00 PM 137 4444 P2 -30000 7000 2000 3/7/2012 3/7/2012 4:31:00 PM 6:16:00 PM 105 4444 Group 2 P1 -233000 30000 15000 3/7/2012 3/7/2012 6:34:00 PM 7:55:00 PM 81 4444 P3 -50000 50000 50000 3/7/2012 3/7/2012 6:59:00 PM 7:00:00 PM 1 4444 Group 3 P1 -47000 20000 10000 3/7/2012 3/7/2012 9:05:00 PM 9:48:00 PM 43 6789 P2 42000 25000 10000 3/7/2012 3/7/2012 9:24:00 PM 10:49:00 PM 85 6789 P4 8000 21000 8000 3/7/2012 3/7/2012 9:38:00 PM 10:55:00 PM 77 6789 Step 2 Combinations Flagged Group 1 P1 & P2 P1, P2 Group 2 P1 & P3 Group 3 P1 & P2 P1 & P2 P1 & P4 P1 & P2 & P4 P1 &P2 & P4
... View more