Hello,

I want to generate following:
gen capm1 = rmrf if decile == 1
and this 10x times, basically until
gen capm10 = rmrf if decile == 10

Do I have to type this in 10x myself or can I use foreach? Is foreach possible with function gen, because the variablename has to change every time?

At the end I would also like to form 10 regressions looking like this, which is perhaps more possible with foreach? :
reg decile1 capm1 until reg decile10 capm10