For creating a high-quality publication-ready table of correlations from Stata output, we need to install asdoc program from SSC first.
ssc install asdoc, update
Once the installation is complete, we shall add the word asdoc
to the cor
command of Stata. Since we estimate correlations among all numeric variables of a dataset by typing cor
in Stata, we shall add asdoc as a prefix to the cor command. Let us load the auto.dta data from the Stata example files.
Example 1: Make a table of correlation for all variables.
sysuse auto, clear asdoc cor
Example 2: We can report variable labels instead of variable names
asdoc cor, label replace
Further, it is possible to write names of the variables in the column headings instead of sequential numbers. For this, we shall invoke the option nonum. Therefore, see example 3.
Example 3: Write variable names in column headers
sysuse auto, clear asdoc pwcorr, nonum replace
Read also :
Generate a correlation table with significance/stars
Generate a table of descriptive statistics
Generate a table of customized descriptive statistics