Hi!

Im am trying to create a loop for predicting stock returns on a dataset I have. My supervisor said that if I use "predict yhat", stata wil use the whole timeframe to predict the returns. My question is: Are there a way to create a loop here, so it predicts the return on using the last 24 months continuously. I am using monthly data. Thanks in advance!