Good morning everyone,
This question is related to an existing topic (https://www.statalist.org/forums/for...xport-to-excel), but I did not find any reliable solution to solve my problem.
I want to extract estimated betas and p-value in separate regressions and put them into an excel file.
I obtain only "0" in column B. Column A is correct. I think the mistake comes from the r(table). How can I correct my code ?
This question is related to an existing topic (https://www.statalist.org/forums/for...xport-to-excel), but I did not find any reliable solution to solve my problem.
I want to extract estimated betas and p-value in separate regressions and put them into an excel file.
Code:
putexcel set "PATH\results", replace
local row = 2
foreach c of global VAR {
reg y i.`VAR' $county i.year, cluster(county)
putexcel A`row'=("`c'")
scalar beta = r(table)[1,1]
scalar pval = r(table)[4,1]
putexcel B`row'= beta
putexcel D`row'= pval
local ++row
}

Comment