Hi,

I am looping over several independent variables, and I am trying to end up with a matrix that combines results for each regression. With one empty row separating results.
This is the code I have written so far, which overwrites instead of appends:

Code:
local indicators employment degree
local invars X Y

foreach depvar of local indicators{
    foreach invar of local invars{

            matrix result_`invar'=J(1, 3, .)            

            svy: regress `depvar' dummy if Year==2010 & invars==`invar'
             matrix temp1_`invar'`=r(table)

            matselrc temp1_`invar' temp2_`invar', c(1) r(1 2 4)
                                        
            matrix temp2_`invar' = temp2_`invar''
                

            matrix result_`invar'= result_`invar'\temp2_`invar'

            }
}
So basically I would like to end up with a matrix that has 3 rows (one for X, an empty one, and one for Y). And three columns, where the coefficient, standard error, and pvalue are printed.

And I know things like outreg or esttab would be easier, but unfortunately I need my results in matrix format.

Can anyone help me with this?

Thank you.