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
Related Posts with Loop function
Summary stat. to excelDear All, I would like to export my results to an excel sheet. I tried this code below but it did n…
Help with small sample panel data with cross-sectional dependenceI'm using the CCE estimation technique for a research work. My dataset consists of eight cross-secti…
Selectively dropping 1 of 2 similar variables measured on the same dateData cleaning question: I have a longitudinal data set from 2009 to 2020 involving children and adol…
Event History Analysis vs. LogitI have a conundrum regarding a policy analysis I'm running. I have a variable stateorder that is cod…
Question on bar graph (percentages of answer options) by group for more than 3 variablesHi all I am fairly new to Stata and the forum, I hope the way I described my problem is ok! Thank …
Subscribe to:
Post Comments (Atom)
0 Response to Loop function
Post a Comment