Hello everyone

I have timeseries data containing the returns of an index and the returns of different shares. My goal is in a first step to regress each share return separately on the index return and then to save the estimated coefficients and standard deviations in order to display them in a table like in the regression outputs.

What I am struggling to find out is a code with which to do this repeating computation in Stata. I guess a for loop would be the answer but I am not yet familiar with it in Stata. So I would be very grateful if anyone could give me a hint.

My data has the following structure:

index return stock1 stock2 stock3
return1,1 return2,1 return3,1 return_i,1
return1,2
return2,2
return3,2
return_i,2
return1,3
return2,3
return3,3
return_i,3
return1,t return2,t
return3,t
return_i,t