Export flexmat file with asdocx to Word, Excel, or LaTeX
The flexmat program is an excellent tool for creating customized tables. In this post, I will demonstrate how to create a table title, table body, and table notes in flexmat and then export them using asdocx.
Setting the file name
Initially, the flexmat program searches the memory for a file name that users might have specified using the save() option of asdocx. If flexmat is used before asdocx in a Stata session, it defaults to the file name Myfile.docx
. However, if a user wishes to use a different file name when exporting the output with asdocx, the file name must be set using the asdocx setfile
sub-command with the save()
option. For instance, if the user wants to to set the file name as Table X : Multivariate regression for all countries.docx, they would use the following command:
asdocx setfile, save(Table X : Multivariate regression for all countries.docx)
If the output needs to be sent to an Excel file, the file extension should be changed to .xlsx,
as shown below:
save(Table X : Multivariate regression for all countries.xlsx)
.
Other options of Asdocx can also be used when setting the file name. For example, font(font_name)
can be used to change the font family or fs(#)
to set the font size of the document [see other options here]. Here is an example:
asdocx setfile, save(Table X : Multivariate regression for all countries.docx) font(Arial)
Table title and notes
Table title and notes can set in flexmat using the `addparts` sub-command with the `title()` and `notes()` options. Here’s an example:
flexmat addparts, title(Table X : Multivariate regression for all countries.docx) /// notes(Sample is from 1990-2021)
Export with asdocx
Once the flexmat file is ready, it can be exported to any of the other formats by asdocx’s , which include MS Word, Excel, or LaTeX. The syntax for exporting files using the asdocx as follows.
asdocx export