Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • asdoc: An easy way of creating publication quality tables from Stata commands

    I am really excited to announce the launch of my new program asdoc that sends Stata output to MS Word or RTF format. asdoc creates high-quality, publication-ready tables from various Stata commands such as summarize, correlate, pwcorr, tab1, tab2, tabulate1, tabulate2, tabstat, ttest, regress, table, amean, proportions, means, and many more. Using asdoc is pretty easy. We need to just add asdoc as a prefix to Stata commands [See this short blog entry for quick start]. asdoc has several built-in routines for dedicated calculations and making nicely formatted tables.

    Installation
    The program can be installed from SSC by typing the following in Stata command window:

    Code:
    ssc install asdoc, replace
    Once installed, you can read the help file with
    Code:
    help asdoc
    The help file is very generous in providing examples and discussions. It has 79 examples.



    Key Features
    Though the help file and my website page provide sufficient details on different aspects of the program, let me highlight the key features of the program below:

    1. Nicely formatted tables for frequently used statistics
    asdoc has dedicated routines for producing nicely formatted tables of most frequently used statistics such as summary statistics, correlations, regressions, frequency tables, and t-tests. Users can easily specify the number of decimal points, font size, table titles, column titles, and other aspects of these statistics.

    2. Full and nested regression tables
    asdoc can create two types of regression tables. The first type (call it detailed) is the detailed table that combines key statistics from the Stata's regression output with some additional statistics such as mean and standard deviation of the dependent variable etc. This table is the default option in asdoc. The second table is a compact table that nests more than one regressions in one table (call it nested). There also a YouTube video that shows how to create nested regression tables with asdoc. Both types of tables are publication-quality and can be directly used in research papers and theses, etc.

    3. Writing all statistics to one document
    asdoc provides the convenience of writing all statistics to a single document with its option append. Even it allows the construction of tables in pieces with its option rowappend. Further, it allows adding text or paragraphs with an option text. This is useful when we want to add details or comments with the Stata output.

    4. Formatted tables of t-tests
    The primary challenge in reporting results of the ttest command is what statistics to report and in which format to report. The format should be such that it occupies minimum space possible. Over many other possibilities, I preferred the format of a single line for all types of t-tests. Therefore, whether it is one-sample t-test or two-sample or other forms, asdocmanages to report the results line by line for each test. asdoc also allows accumulating results from different runs of t-tests. For this purpose, the option rowappend of asdocreally comes handy.

    5. Frequency tables
    asdoc has several built-in routines for reporting properly formatted frequency tables. As with other commands, we need to just add asdoc as a prefix to the tabulation commands that includes tabulate, tabulate1 tabulate2, tab1, and tab2, etc.

    6. Compact tables
    asdoc makes some elegant tables when used with tabstat command. There are several custom-made routines in asdoc that create clean tables from tabstat command. asdoc fully supports the command structure and options of tabstat. And, yes asdoc allows one additional statistics, that is, t-statistics alongside the allowed statistics in tabstat. For reporting purposes, asdoc categorizes tabstat commands in two groups: (1) stats without a grouping variable (2) stats over a grouping variable.

    7. Flexible tables
    Exporting tables from table command was the most challenging part of asdoc programming. Nevertheless, asdoc does a pretty good job in exporting table from table command. Therefore, asdoccan export one-way, two-way, three-way, and four-way tables.

    8. Exporting dataset
    Stata's list command displays the values of variables. asdoc can export these values to a file in form of a nicely formatted table. asdoc implements the most basic version of list command and might not accept some of its options such as mean, sum, etc. However, the [if] [in] qualifiers are accepted.

    9. Exporting Stata matrix
    asdoc can export a Stata's matrix to a file in form of a nicely formatted table.

    10. List of unique values
    To report one value per group or unique values of varlist, we can use the aslist command of asdoc

    11. Export variable names and labels to a table
    asdoc can be used with the Stata describe command to make a table of variable names, labels, etc.

    12. Other Stata commands
    Stata commands that have some output in the result window can also be used with asdoc . Even when a command does not have an output and asdoc is unintentionally added as a prefix, asdoc will just pass the command to Stata without generating any output. asdoc might come up with a less than pretty output if it is used with a Stata command that does not have a standard table format. If a user-written command that estimates regression model is used with asdoc, option isregcan be used to tell asdoc that the command is a regression command.


    Acknowledgment

    Professor River provided helpful suggestions on improving the display format of the correlation tables.

    Since this is the first version, programming bugs are likely to exist. I shall really appreciate comments and suggestions for improving asdoc. You can reach me at attaullah.shah@imsciences.edu.pk

    Support website: www.FinTechProfessor.com
    Regards
    --------------------------------------------------
    Attaullah Shah, PhD.
    Associate Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
    www.FinTechProfessor.com
    If you use MS Word, do check my asdoc program that easily sends Stata output to MS Word

  • #2
    Thanks Attaullah Shah,
    This is such a big break through Shah. i've gone through it personally and most of my problems i earlier posted have been greatly solved.
    I appreciate the good work

    cheers

    Comment


    • #3
      Thankyou Sir. This is very useful.

      Comment


      • #4
        Seems very useful! can an option to write to csv\excel file be added?

        Comment


        • #5
          Dear Ariel Karlinsky , right from the beginning, I planned writing the asdoc program for MS Word or RTF reader. I appreciate your comments and I have noted your suggestions. I shall definitely consider csv/Excel format in future updates of the program.
          Regards
          --------------------------------------------------
          Attaullah Shah, PhD.
          Associate Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
          www.FinTechProfessor.com
          If you use MS Word, do check my asdoc program that easily sends Stata output to MS Word

          Comment


          • #6
            Dear Dr. Attaullah Shah :
            Hi, I am one of the stata learners and fans. I appreciate that you develop "asdoc" program, which helps me a lot during the stata exporting process.
            while I met some problems when i ran the program related to "ttest". when i execute this program, such as
            Code:
            asdoc ttest mpg==price, replace
            . the system will remind me that "command aseploc is unrecognized" . i am wonder there is something wrong about the program, or maybe it indicates a problem with my stata version and something else.


            Best wishes!

            Comment


            • #7
              The problem is that I forgot to add aseploc program in the asdoc files. In the next update, I shall add it. For time being, you can install the program from my website, type the following in Stata command window.

              Code:
              net install aseploc, from(http://FinTechProfessor.com)
              Regards
              --------------------------------------------------
              Attaullah Shah, PhD.
              Associate Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
              www.FinTechProfessor.com
              If you use MS Word, do check my asdoc program that easily sends Stata output to MS Word

              Comment


              • #8
                here is the method to export the results of t-test via the professor Shah's timely and friendly help.
                Attached Files

                Comment


                • #9
                  How would I report post-estimation command results? I am specifically interested in reporting my output from my suest command (Baron and Kenny mediation analysis). Thank you, Dr. Shah, for this amazing program and your help. I will be sure to cite your program in my research.

                  Comment


                  • #10
                    Here is one example to use asdoc with suest

                    Code:
                     webuse income
                    regress inc edu exp if male
                    estimates store Male
                    regress inc edu exp if !male
                    estimates store Female
                     suest Male Female
                    See the attached file "Myfile.doc ​​​​​​" that is produced by asdoc.

                    I am not familiar with Baron and Kenny method in Stata, however, whatever command it has, you can try adding asdoc as a prefix to that command.
                    Regards
                    --------------------------------------------------
                    Attaullah Shah, PhD.
                    Associate Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
                    www.FinTechProfessor.com
                    If you use MS Word, do check my asdoc program that easily sends Stata output to MS Word

                    Comment


                    • #11
                      Let me thank you first for this wonderful program. I have used it with many Stata commands and it successfully sends Stata output to MS Word in great-looking tables. I have one question. I want to put all nested regression tables in one word file and I try the append function and different table name function, but I can not be successful to put them into one word file. Could you give me some advices about it?

                      Comment


                      • #12
                        I think you want to generate two nested tables, for that you can consider the reset option when using nest option in asdoc. For a more relevant answer, can you please share an example dataset and the codes that you have used for the nested regression tables.
                        Regards
                        --------------------------------------------------
                        Attaullah Shah, PhD.
                        Associate Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
                        www.FinTechProfessor.com
                        If you use MS Word, do check my asdoc program that easily sends Stata output to MS Word

                        Comment


                        • #13
                          Dear Professor Shah,

                          Thanks a million for sharing this super handy code! It is quite helpful and will definitely save a lot of time for researchers all around the world.

                          Comment


                          • #14
                            Changyan Peng Thanks for your comments. I shall appreciate if you spread the word among your circles of researchers.
                            Regards
                            --------------------------------------------------
                            Attaullah Shah, PhD.
                            Associate Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
                            www.FinTechProfessor.com
                            If you use MS Word, do check my asdoc program that easily sends Stata output to MS Word

                            Comment


                            • #15
                              The following code:
                              Code:
                              webuse byssin1, clear
                              asdoc table race sex, c(mean smokes median pop)
                              creates a table, yet issues the following note:
                              Code:
                              note: cellwidth too small, cannot display column heading;
                              to increase cellwidth, specify cellwidth(#)
                              Yet if I specify cellwidth(), I get the following error:
                              Code:
                              option cellwidth() not allowed

                              Comment

                              Working...
                              X