Creating tables in Stata using asdoc is super-easy. In this short post, I’ll show how to use asdoc to export Stata data to MS word files. If you have not already installed asdoc, it can be installed by

ssc install asdoc


For exporting values from the data files, we can use the sub-command list of asdoc. We can also make the command conditional using the in and if qualifiers. In the following example, let us use the auto data set from the system folders

sysuse auto, clear
asdoc list price trunk mpg turn in 1/10 , replace




In the above line of code, we wrote asdoc and the sub-command list. After that, we specified the names of the variables that we wanted to export to the MS word document. These variables included price trunk mpg turn. After that, we used the phrase in 1/10, that is the in qualifier to report observation 1 to 10. The option replace will replace any existing output file with the name Myfile.doc



  1. Dr.Shahzad Hussain December 13, 2018 at 10:48 am - Reply

    AOA Sir,
    I really appreciate your contribution toward the academic world

  2. Faisal Khan December 14, 2018 at 11:42 am - Reply

    Sir, Is this command allow as to assign title of table or title to file. As we have such option in outreg command. Similarly can we use append command if we need to expand a table.

  3. Attaullah Shah December 14, 2018 at 11:47 am - Reply

    Faisal Khan: Yes, asdoc allows title(), so the above code with title will look like

    asdoc list price trunk mpg turn in 1/10 , replace title(Table 1: List of Variables) 
  4. Kabir Ahmed March 24, 2019 at 8:32 pm - Reply

    The command asdoc and other as*** is very helpful

    • Attaullah Shah March 24, 2019 at 11:09 pm - Reply

      Kabir Ahmed
      Thanks for your feedback. I hope you shall cite asdoc in your research.

  5. Tsi Njim May 11, 2019 at 4:58 pm - Reply

    Dear Sir,

    I am amazed at how much your work has helped me in my dissertation and I will surely cite it and give it the praise it deserves.

    I do have an urgent problem with the asdoc command and I will appreciate your help in the issue.

    I have a numeric variable in stata, with a storage type “double”
    The variable name is blood_pressure

    When I run the following command

    asdoc list if blood_pressure > 60

    The command runs very well.

    But If I run the following command

    asdoc list if blood_pressure == .

    I receive the following error message:

    invalid syntax

    Is there a reason why I am getting this error message?

  6. Attaullah Shah May 12, 2019 at 12:28 am - Reply

    I think you are using an old version of asdoc. If so, re-install it

    ssc install asdoc, replace

    If that does not solve the problem, there is a workaround. We shall first preserve the data, keep only required observations, use asdoc on that sample and again restore the full dataset

    keep if blood_pressure == . 
    asdoc list, replace
  7. Jan Mueller June 15, 2019 at 4:26 am - Reply

    Dear Mr. Shah,

    I really do like your work with asdoc.
    Is there a solution within the “asdoc list” subcommand to use the variable labels instead of the variable names. The option “label” as in other asdoc commands seems to be without function.

    Best regards

    • Attaullah Shah June 15, 2019 at 12:05 pm - Reply

      Juan Mueller
      You have not specified whether you are asking for variable labels or value labels. I have added variable labels to asdoc now. You can download the updated version by pasting the following line in Stata

      net install asdoc, from( replace

      After installation, you can report variable labels instead of variable names using the label option. For example

      sysuse auto
      asdoc list make price mpg, label

      Please tell me whether this was you were asking for. Please cite asdoc in your research.

  8. Jan Mueller June 15, 2019 at 1:56 pm - Reply

    That was a quick response!

    Yes, i was looking for the variable names. It works perfect!
    Thank you very much.

  9. Albena April 25, 2020 at 6:02 pm - Reply

    Hello, I am using asdoc currently and came across one issue.

    I have names of locations that include French symbols and with the export to Word somehow this is not recognized. I get weird symbols where there is for example accent (é) and I have to correct that manually. Any idea or advice on how to fix that?

    Many thanks in advance!


Leave A Comment