Sports Forecasting - a million iterations


I am working on a forecasting project and would like to create a script that automates the following steps:
order data by X characteristic
Create groupings 1...N. (Say deciles)
run regression on the sample data for each decile group arranged by X
Determine result. (A mathematical formula is run on the forecasted output)
Repeat for test data set
Review the aggregate results

I have no idea how to automate this in S+. Have been relying on manual modifications which is very very time consuming. I would love a script that could run the process for me. Say I enter a few initial parameters: here are my grouping fields, i would like quintiles vs deciles vs other, etc.

Any ideas how I can create this script in Splus.
Alternatively, any other approach I should take? Perhaps data mining however my skill level here is almost nil

Any help would be greatly appreciated!

Thank you,


Ps - My current model has ranged in success the past 3 NFL years with accuracy of 56-60%. Ie, all profitable.