Stata - Do-file capability


I am wondering about the programming capabilities of Stata when using Do-files. Essentially, I am looking to predict values using multiple regression. However, I would need to predict a large number of values and I am wondering if I can create a do-file that will help achieve this as opposed to manually performing it all.

To give a quick idea:

- I have 1450 data points (days), but I only want to run a regression on the 1400 data points and then predict the other 50 and see how close I come.
- Thus, to predict day 1400, I run regress...if day<1399
- Then, predict "yhat" if day==1400
- I then receive this prediction, all is well
-But now I would like to repeat and predict for day 1401 by running a regression and now using my actual data for day 1400 (not the prediction). So I regress....if day<1401....and then predict yhat if day==1402.

So I have two questions I suppose. (1) Does Stata even have the capability to perform this sort of repeating operation? (2) Is anyone familiar enough to know what commands I would use to sort of automate this?

Thank you kindly in advance for any of your help!!!
Last edited: