Hi:
It's good you have a program that produces the desired results. Now you have to understand the program well enough to change the logic for your "real" data.
A couple of observations/questions:
It seems to me that you could potentially have an array bigger than 5 days???? What is the upper limit? Are you bound by a fiscal year? Could the number of days be more than 366?? You said you wanted to project a balance between now and the end of October -- so by that statement, the implication is that your DAYOFTRANSACTION variable is probably NOT DAY1, DAY2, DAY3, etc. My guess would be that DAYOFTRANSACTION is either a date value or a character string that represents a real date.
Is DAYOFTRANSACTION a character variable or a numeric variable??? Is it a full date: 09/10/2010 or is it a julian date: 10253 or is it a RDBMS date/time stamp: 09/10/2010:01:01:01??? Is the DB2 date a character string version of the date???
The program that was posted substrings the 1, 2, 3, 4, 5, etc out of the DAYOFTRANSACTION variable to use as an index for the array and the array is hard-coded to be only 5 members. It is possible to index an array by a day or date value, but then, knowing the upper bound or potential size of the array would be important. Will there always be a one to one correspondence between the rows in account_initial and the transactions???
I probably would have taken a slightly different approach (I wouldn't have made the DAY1-DAY5 array -- I would have made the BAL1-BAL5 array and made a variable in account_initial called START. Then I just would have added START to every memeber of the BAL1-BAL5 array.
But rather than tweaking this program, I would recommend that you focus more on the logic issues involved in adapting this program to your real data -- not your made up data. Some good papers on using arrays are:
http://support.sas.com/rnd/papers/sgf07/arrays1780.pdf
http://www2.sas.com/proceedings/sugi27/p066-27.pdf
http://www2.sas.com/proceedings/sugi30/242-30.pdf
cynthia