Hello,

I was trying to export the table into Excel. Here is my code:
Code:
local excel = "C:\Users\hanling3\Box\My Box Notes\Tables\Merged Tables.xlsx"

local varlist_cc "b_cc_women_only_total b_cc_men_only_total b_cc_shared_only_total b_cc_neither_total"
tabstat `varlist_cc', by(bmbaby) columns(variables) noseparator save
return list
mat results = r(StatTotal)' // the prime is for transposing the matrix
putexcel set "`excel'", sheet("Childcare") modify // remember to specify the full path
putexcel A1 = matrix(results)
I was following this instruction: https://blog.stata.com/2017/01/24/cr...a-expressions/

The problem is, when I
Code:
return list
, it will return many matrices as below. But I only want to get a big matrix. Is there anyway to combine these matrices or return a big matrix directly?

Code:
matrices:
             r(Stat19) :  1 x 4
             r(Stat18) :  1 x 4
             r(Stat17) :  1 x 4
             r(Stat16) :  1 x 4
             r(Stat15) :  1 x 4
             r(Stat14) :  1 x 4
             r(Stat13) :  1 x 4
             r(Stat12) :  1 x 4
             r(Stat11) :  1 x 4
             r(Stat10) :  1 x 4
              r(Stat9) :  1 x 4
              r(Stat8) :  1 x 4
              r(Stat7) :  1 x 4
              r(Stat6) :  1 x 4
              r(Stat5) :  1 x 4
              r(Stat4) :  1 x 4
              r(Stat3) :  1 x 4
              r(Stat2) :  1 x 4
              r(Stat1) :  1 x 4
          r(StatTotal) :  1 x 4

Thank you!