Friday, December 19, 2025

Export tabulation outcomes to Excel-Replace


It’s summer season, which suggests now we have interns working at StataCorp once more. Our latest intern, Chris Hassell, was tasked with updating my community-contributed command tab2xl with a lot of the recommendations that weblog readers left within the feedback. Chris up to date tab2xl and wrote tab2docx, which writes a tabulation desk to a Phrase file utilizing the putdocx command.

To put in or replace your tab2xl command, sort

. web set up http://www.stata.com/customers/kcrow/tab2xl, exchange

To put in the brand new tab2docx command, sort

. web set up http://www.stata.com/customers/kcrow/tab2docx

tab2xl now permits weights, if, in, formatting of the cells, and two-way tabulations. As soon as put in, you may sort

. sysuse auto, clear
(1978 Vehicle Information)

. tab2xl rep78 international in 1/50 [fweight=mpg] utilizing testfile, col(1) row(1)
file testfile.xlsx saved

to supply

To jot down the desk to a Phrase doc, it’s essential to first open a .docx file utilizing the command putdocx start, sort your tab2docx command to append the desk to your file, after which save the doc utilizing putdocx save filename. For instance, typing

. sysuse auto, clear
(1978 Vehicle Information)

. putdocx start

. tab2docx rep78 in 1/50 [fweight=mpg]

. putdocx save testfile.docx

will produce

Chris did a wonderful job updating tab2xl and coding tab2docx, making it simpler so that you can create tables for inclusion in a Phrase file.



Related Articles

Latest Articles