Hi everyone!
I need some comment/suggestions on exporting multiple tables to excel using the putexcel commant.
I am creating lots of multivariate logistic regression tables that I want to export to excel. I am using the putexcel command and it works perfectly fine when I export one table at a time. I use the following syntax:
xi: clogit depvar var1 var2, group() or
putexcel A2=(e(cmdline)) B4=matrix(r(table)', names) using results.xlsx
xi: clogit depvar var1 var2 var3, group () or
putexcel A12=(e(cmdline)) B14=matrix(r(table)', names) using results.xlsx, modify
...
...
The exported tables look like the original Stata13 tables; the variables are in rows and the coefficients in columns. Which is the layout I like the most.
​However, when I try exporting more than one table at a time, all variables, coefficients and values are transposed. I mean, variables are now in columns and the coefficients in rows. This layout is not the best one when you have to show long tables with 3-4 different models with 6-10 varialbes each. The syntax I run in this case is the following:
xi: clogit depvar var1 var2, group () or
matrix A = r(table)
xi: clogit depvar var1 var2 var3, group () or
matrix B = r(table)
...
...
putexcel A2=(e(cmdline)) B4=matrix(A, names) using results.xlsx
putexcel A12=(e(cmdline)) B14=matrix(B, names) using results.xlsx, modify
...
I do not understand what I am doing wrong or why Stata is transposing the tables. Does anyone have a suggestion on how to export several tables with the same layout Stata shows? I will really appreciate any comment because it is time consuming to export tables one by one, or transposing the exported tables back to the original layout.
Thank you very much.
Javier Cotignola
I need some comment/suggestions on exporting multiple tables to excel using the putexcel commant.
I am creating lots of multivariate logistic regression tables that I want to export to excel. I am using the putexcel command and it works perfectly fine when I export one table at a time. I use the following syntax:
xi: clogit depvar var1 var2, group() or
putexcel A2=(e(cmdline)) B4=matrix(r(table)', names) using results.xlsx
xi: clogit depvar var1 var2 var3, group () or
putexcel A12=(e(cmdline)) B14=matrix(r(table)', names) using results.xlsx, modify
...
...
The exported tables look like the original Stata13 tables; the variables are in rows and the coefficients in columns. Which is the layout I like the most.
​However, when I try exporting more than one table at a time, all variables, coefficients and values are transposed. I mean, variables are now in columns and the coefficients in rows. This layout is not the best one when you have to show long tables with 3-4 different models with 6-10 varialbes each. The syntax I run in this case is the following:
xi: clogit depvar var1 var2, group () or
matrix A = r(table)
xi: clogit depvar var1 var2 var3, group () or
matrix B = r(table)
...
...
putexcel A2=(e(cmdline)) B4=matrix(A, names) using results.xlsx
putexcel A12=(e(cmdline)) B14=matrix(B, names) using results.xlsx, modify
...
I do not understand what I am doing wrong or why Stata is transposing the tables. Does anyone have a suggestion on how to export several tables with the same layout Stata shows? I will really appreciate any comment because it is time consuming to export tables one by one, or transposing the exported tables back to the original layout.
Thank you very much.
Javier Cotignola
Comment