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
.........
Related Posts with convert a matrix to a column vector, and then output it to Excel file
Transforming dataset with several variables and a 'value' variableDear all, I have a problem in Stata that I have been struggling with for quite some time now. As yo…
Gravity model - HS6 product level - PPML and fixed effectsHi, For my Master's thesis I would like to estimate a gravity model using three specifications: Bil…
Spell lengthDear Statalisters, I am trying to calculate the spell length to capture the first transition from p…
Frequencies of Multiple Variables in one Table(one way)Hello everyone, I have a problem concerning displaying frequencies of different variables in a tabl…
Number of children in household variable from individual level datasetDear all I am using the PALMS dataset (Post-Apartheid Labour Market Survey) - it is a stacked crosse…
Subscribe to:
Post Comments (Atom)
0 Response to convert a matrix to a column vector, and then output it to Excel file
Post a Comment