Dear All,
I wonder if anyone has an idea how to output R2 of the regression equations to an Excel file using loops (since I have to run lots of regressions automatically) especially to those columns that start from AA, AB etc.?
The idea is to output cross-variable R2 to the following table (that is in Excel file):
Now I have this part of the code:
local row = 3
local col = 3
foreach dep_var of varlist * {
foreach indep_var of varlist * {
regress `dep_var' `indep_var'
local Cell = char(64 + `col') + string(`row')
putexcel `Cell' = (e(r2))
local col = `col' + 1
}
local row = `row' + 1
local col = 3
}
However it works corectly only over Excel columns from A to Z and not more.
Does anyone know how to proceed with this output futher from AA, AB, etc...? Thank you for any advice!!!
Regards,
Antonina
I wonder if anyone has an idea how to output R2 of the regression equations to an Excel file using loops (since I have to run lots of regressions automatically) especially to those columns that start from AA, AB etc.?
The idea is to output cross-variable R2 to the following table (that is in Excel file):
var 1 | var2 | var 3 | |
var 1 | 1 | R2 (between var 1 and var 2) | R2 |
var 2 | R2 | 1 | R2 |
var 3 | R2 | R2 | 1 |
local row = 3
local col = 3
foreach dep_var of varlist * {
foreach indep_var of varlist * {
regress `dep_var' `indep_var'
local Cell = char(64 + `col') + string(`row')
putexcel `Cell' = (e(r2))
local col = `col' + 1
}
local row = `row' + 1
local col = 3
}
However it works corectly only over Excel columns from A to Z and not more.
Does anyone know how to proceed with this output futher from AA, AB, etc...? Thank you for any advice!!!
Regards,
Antonina
Comment