Hello, I need your help on matrix and Excel in Stata.
I have a matrix m and would like to stack its columns, making it a column vector and then output it to excel. How may I do it? I got an error message but do not know how to proceed. Your help is highly appreciated.
mata
m1 = colshape(st_matrix("m"), 1)
end
getmata m1
export excel using test.xlsx, replace
putexcel set results211117.xlsx, sheet(a, replace) modify
This is my matrix m (The column names are 0, 1, 2,......8)
. matrix list m
m[10,9]
0 1 2 3 4 5
bxxxxxxx .52266514 .58911588 .83552992 .56056369 .8199342 .7093596
pxxx 3.732e-17 4.505e-07 1.945e-11 8.223e-08 .00003257 2.086e-37
pyyy 7.988e-15 .00036929 .16934102 .00002184 .35435738 3.141e-09
impoxxxxxxxx .69417235 .97630077 1.0495413 .75846318 1.0857929 1.010838
pxxx .00005891 3.303e-10 1.661e-06 .00010401 5.796e-06 1.058e-06
pyyy .07332287 .87432756 .81737478 .21084674 .71513743 .95735001
impoaaaaaaaa .35782885 .18078305 .57813267 .31135534 .46354425 .39562263
pxxx .11893438 .47588783 .00996288 .25309767 .14475445 .06826691
pyyy .00535643 .00136421 .05931852 .01186249 .09168185 .00553321
pxxxxxxxxxx .38558787 .02224672 .18134953 .28309624 .12058027 .13453773
.........
I have a matrix m and would like to stack its columns, making it a column vector and then output it to excel. How may I do it? I got an error message but do not know how to proceed. Your help is highly appreciated.
mata
m1 = colshape(st_matrix("m"), 1)
end
getmata m1
export excel using test.xlsx, replace
putexcel set results211117.xlsx, sheet(a, replace) modify
This is my matrix m (The column names are 0, 1, 2,......8)
. matrix list m
m[10,9]
0 1 2 3 4 5
bxxxxxxx .52266514 .58911588 .83552992 .56056369 .8199342 .7093596
pxxx 3.732e-17 4.505e-07 1.945e-11 8.223e-08 .00003257 2.086e-37
pyyy 7.988e-15 .00036929 .16934102 .00002184 .35435738 3.141e-09
impoxxxxxxxx .69417235 .97630077 1.0495413 .75846318 1.0857929 1.010838
pxxx .00005891 3.303e-10 1.661e-06 .00010401 5.796e-06 1.058e-06
pyyy .07332287 .87432756 .81737478 .21084674 .71513743 .95735001
impoaaaaaaaa .35782885 .18078305 .57813267 .31135534 .46354425 .39562263
pxxx .11893438 .47588783 .00996288 .25309767 .14475445 .06826691
pyyy .00535643 .00136421 .05931852 .01186249 .09168185 .00553321
pxxxxxxxxxx .38558787 .02224672 .18134953 .28309624 .12058027 .13453773
.........
Comment