asdocx is a powerful tool in Stata for creating rich documents with well-formatted tables. This guide will walk you through the basics of using asdocx to transform your Stata matrices into neat tables.

Syntax Overview

asdocx wmat, matrix(matrix_name) [rnames(row names) cnames(row names) replace append other_options]

Detailed Description

wmat is the command name, an abbreviation for ‘writing matrix.’ The option matrix() is required to specify the name of an existing matrix. The options rnames() and cnames() are optional and used to specify the row and column names of the matrix. If these options are left blank, the existing row and column names of the matrix will be used. Other asdocx options can also be utilized with wmat. For instance, replace will overwrite an existing output file, while append will add to the existing file. The option fs() sets the font size, and title() can be used to specify the title of the matrix in the output file.

Creating a matrix with uniform numbers.

mat A = matuniform(10, 5)


Writing the created matrix to a file.

asdocx wmat, mat(A) replace

Appending another matrix with custom row and column names.

mat B = matuniform(4, 6)
asdocx wmat, mat(B) append rnames(Sugar Honey Muffin Pie) cnames(Chili Diablo Pepper Capsicum Kambuzi Malagueta)

wmat export stata matrix to word excel with asdocx