asdoc : Creating high quality tables of summary statistics in Stata

Ever wanted to create high-quality summary statistics with one click in Stata. asdoc creates excellent tables of summary statistics such as mean, standard deviation, minimum, maximum, etc. asdoc offers four different methods of creating tables of summary statistics. These are discussed below with examples and relevant options. To know about installation of the program and other feature, you can visit this blog post. 

Simple tables of summary statistics:
To create a simple table of summary statistics, we normally type summarize or sum command in Stata. To send output from sum command to a Word document, we shall type the following. A picture of the output file is also shown below.

sysuse auto
asdoc sum

Summary / descriptive statistics for selected variables 

asdoc sum price mpg rep78 headroom trunk

 

Summary / descriptive statistics with [if] [in] conditions

asdoc sum price mpg rep78 headroom trunk if price>4000

 

Reporting customized decimal points

asdoc sum, dec(2)

4 Comments

Nicola Deghaye MSc (Health Econ)

November 20, 2018at 12:34 pm

Hi
I am using Stata 14 and am battling with “asdoc” with tabstat.
Here is my code:

tabstat TotalLWD_2013, by (quintile) stat(N mean median sem) format

which produces:

quintile |         N      mean       p50  se(mean)
---------+----------------------------------------
       1 |   8018.00      1.44      0.00      0.13
       2 |   6467.00      1.85      0.00      0.16
       3 |   5324.00      3.45      0.00      0.25
       4 |   1807.00      6.08      0.00      0.65
       5 |   2103.00     11.61      0.00      0.71
---------+----------------------------------------
   Total |  23719.00      3.26      0.00      0.12
--------------------------------------------------

asdoc tabstat TotalLWD_2013, by (quintile) stat(N mean median semean) ///
save(prevalence by category raw data 2013.doc) replace  
 
or

asdoc tabstat TotalLWD_2013, by (quintile) stat(N mean median semean) format ///
save(prevalence by category raw data 2013.doc) replace  

produce:

Summary statistics 
  	 N	 Mean	 Median	 se(Mean)
TotalLW~2013	25180	3.203	0	.111

In other words, it is not picking up my “by” option – it is giving me a one-way tab instead of a table of statistics of disability prevalence by school category (quintile)
I have tried various combinations of spacing with the by(quintile), but it isn’t solving the problem.

Please help.

Best regards,

    Attaullah Shah

    November 20, 2018at 12:40 pm

    Seems that asdoc is working perfectly with both the commands. However, in your command, there is a space between by and the term (quintile)

    So, you can correct it by

    asdoc tabstat TotalLWD_2013, by(quintile) stat(N mean median semean) ///
    save(prevalence by category raw data 2013.doc) replace  

Faisal Khan

December 15, 2018at 1:57 pm

Dear Sir,
I appreciate your effort and supportive attitude towards the community. I am interested in finding out descriptive statistics of mutual fund category wise.
When I use asdoc command for multiple category and variables it works but the format of the table is not consistent. The format of a table for 1st category is fine but not for the second, similarly 3rd category fine but not 4th and so on.
The Command is
asdoc by category , sort : summarize CH LNTNA EXP FL DL b1 TURNs TURNp RU12 FFV FF1 FF6 FF12 NoFMs DY Beta LnRed, replace

category: I have encode fund category

    Attaullah Shah

    December 15, 2018at 2:01 pm

    Faisal Khan:
    Due to the specific command structure of asdoc, it accepts the by option in two flavors.
    The first is to use bys as a prefix. So the following command should work for you

    bys category :  asdoc  summarize CH LNTNA EXP FL DL b1 TURNs TURNp RU12 FFV FF1 FF6 FF12 NoFMs DY Beta LnRed, replace

    The second method is to use by as an option after using the comma. So the following should also work.

    asdoc  summarize CH LNTNA EXP FL DL b1 TURNs TURNp RU12 FFV FF1 FF6 FF12 NoFMs DY Beta LnRed, replace by(category)

    .
    Let me know if there is any problem with any of these commands.

Leave a Reply

9 + six =