Dear All,
I have the following do file:
I would like to estimate the equation:
for each asset in local asset. Then I want to save the estimations of alpha and beta and export them in an excel file. I use
to ask Stata to put the estimated parameters for each asset in a different row in Excel. However, in the excel file I see only the results for the last asset (ford). The logic is clear: if I set m=2 and then I specify local ++m at each estimation ++m is equal to 3. But how can I set the command such that in row 3 I have the results for microsoft, in row 4 I have the results oracle and so on?
Thanks for your help.
Dario
I have the following do file:
Code:
putexcel set capm.xlsx, sheet(capm) replace putexcel (A1:C1)=("Simple CAPM"), border(bottom, double) merge hcenter vcenter bold putexcel A2=("Stock 1"), hcenter border(bottom) italic putexcel B2=("alpha"), hcenter border(bottom) italic putexcel C2=("beta"), hcenter border(bottom) italic local asset "ermicrosoft eroracle erge erford" foreach i of local asset{ reg `i' ersandp, r local alpha_`i'=_b[_cons] local beta_`i'=_b[ersandp] local m 2 local ++m putexcel A`m'=("`i'"), hcenter putexcel B`m'=("`alpha_`i''"), hcenter putexcel C`m'=("`beta_`i''"), hcenter }
Code:
reg `i' ersandp, r
Code:
local m 2 local ++m
Thanks for your help.
Dario
Comment