asdocx: Create Publication-Quality with ease
If your goal extends beyond basic exporting and you want to save time by avoiding the complex coding of syntax structures like putexcel or layouts,
asdocx is the best available option. In this section, we will explore:
- An introduction to the
asdocx command and its relevance.
- A tutorial on generating top-notch tables tailored for professional use.
- Tips and tricks to enhance the visual appeal and accuracy of your tables.
Introduction to asdocx
asdocx is a premium version of asdoc. It is currently avaiable for $9.99, with plenty powerful features. Using asdocx is pretty easy. You need to add just asdocx as a prefix to Stata commands. For example, we use the sum command to find summary statistics of all numeric variables in the dataset. We shall add just asdocx as a prefix to sum .
In the following paragraph, I show the use of asdocx with some of key Stata commands.
Export summary statistics to excel
asdocx creates comprehensive tables of summary statistics. asdocx provides four distinct methods for generating tables of these statistics. These methods are detailed below, accompanied by examples and relevant options.
1. Default tables of summary statistics
By default, asdocx uses the summary statistics reported by Stata’s summarize command. So, without specifying any options, asdocx will generate a table with statistics including N, mean, standard deviation, min, and max.
sysuse auto, clear
asdocx sum, replace save(Descriptive Statistics.xlsx)
* Summary / descriptive: reporting variable labels
asdocx sum price mpg rep78 headroom trunk, label replace
* Summary / descriptive statistics with [if] [in] conditions
asdocx sum price mpg rep78 headroom trunk if price>4000
* Control decimal points with the dec() option
asdocx sum, dec(2)
2. Detailed summary statistics
For detailed summary statistics in Stata, we typically use the summarize, detail or sum, detail commands. To create a table of these detailed statistics using asdocx, simply append detail after the comma in the asdocx sum command. By doing so, the table will include the following statistics: observations, mean, standard deviation, minimum, maximum, 1st percentile, 99th percentile, skewness, and kurtosis.
* Create detailed summary statistics
asdocx sum, detail save(Myfile.xlsx) replace
3. Custom summary statistics
To make a table of a specific combination of statistics, we shall use the option statistics() with asdocx sum command.
N Number of observations
mean Arithmetic mean
sd Standard deviation
semean Stanard error of the mean
sum Sum / total
min The smallest value
max The largest value
count Counts the number of non-missing observations
cv Coefficient of variation
iqr Interquartile range
p1 1st percentile
p5 5th percentile
p10 10th percentile
p25 25th percentile
p50 Median or the 50 percentile
p75 75th percentile
p99 99th percentile
tstat t-statistics that the given variable == 0
* In the stat() option, you can write any of the above statistics
asdocx sum, stat(N mean sd tstat p1 p99)
4. Summary statistics over a grouping variable
To find summary statistics separately for each category of a grouping variable, we can use by(varname) or the prefix bysort varname: with asdocx.
sysuse auto, clear
asdocx sum, stat(N mean sd tstat p1 p99) by(foreign)
Export table of correlations to Excel
* If we do not use replace, results are appended to the same file
Export tabulations to Excel
* use the NHS dataset from web
webuse nhanes2l, clear
* One way tabulation
asdocx tab agegrp, save(Myfile.xlsx) replace
* Two way tabulation
* Three-way tabulation
Export regressions from Stata to Excel
* Detailed regressions
* Nested regressions
* Wide regressions
3. Exporting Stata Data to Excel
Sometimes, the need is as simple as transferring your Stata dataset to Excel, either for sharing, further analysis, or visualization. This section will cover:
- The advantages of having your data in Excel format.
- A hands-on guide to ensure a smooth data transfer from Stata to Excel.
- export — Overview of exporting data from Stata
- Solutions to common issues faced during the export process.