Announcement

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

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

    Thanks to Prof Kit Baum, version 2.0 asdoc is now available from SSC. To update or install,
    Code:
    ssc install asdoc, replace
    Version 2.0 brings several improvements, adds new features, and fixes minor bugs in the earlier version. Following is the summary of new features and updates. Details of these features can be found on my website here. Following is the summary of the new changes made in version 2.0 of asdoc.

    Brief Introduction of asdoc

    asdoc sends Stata output to Word / 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 a quick start]. asdoc has several built-in routines for dedicated calculations and making nicely formatted tables.


    New Features in Version 2.0

    1. Wide regression tables

    This is a new format in which regression tables can be reported. In this format, the variables are shown in columns and one regression is reported per row. Therefore, this type of regressions tables is ideal for regressions over portfolios, industries, years, etc. asdoc allows a significant amount of customization for wide tables including asterisks for showing significance, reporting t-statistics and standard errors either below the regression coefficients or sideways, controlling decimal points, reporting additional regression statistics such adjusted R2, RMSE, RSS, etc., adding multiple tables in the same file, and several other features.


    2. Allowing by-group regressions

    Version 2.0 of asdoc provides the convenience of estimating regressions over groups and summarizing the regression estimates in nicely formatted tables. This feature follows the Stata default of bysort prefix. This feature works with all three types of regression tables of asdoc that include detailed regression tables, nested tables, and wide tables. In this YouTube video, I show one example.


    3. Allowing by-group descriptive statistics

    Using the bysort prefix with asdoc, we can now find default, detailed, and customized summary statistics over groups. Details related to this feature will be added later on in a blog post.


    4. Option label with tabulate and regress commands

    Option label can now be used with regression and tabulation commands. Using this option, asdoc will report variable labels instead of variable names. In case variable labels are empty, then the variable names are reported.


    5. Developing tables row by row using option row

    Option row is a new feature in version 2. Option row allows building a table row by row from text and statistics. In each run of asdoc with option row, a row is added to the output table. This is a useful feature when statistics are collected from different Stata commands to build customized tables. To know more about this option, read the help file or wait for a blog entry on my website www.FinTechProfessor.com


    6. Accumulate text or numbers with option accum

    Option accum allows accumulating text or numbers in a global macro. Once accumulated, the contents of the macro can then be written to an output file using option row.


    7. Saving files in different folders

    One additional feature of version 2.0 is the ability to work with different folders. So we can write new files or append results to existing files in different folders.
    Last edited by Attaullah Shah; 10 Sep 2018, 03:20.
    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
    Thank you very much for this excellent tool.

    I have told my colleagues about it also.

    Jay

    Comment


    • #3
      Thanks for sharing version 2.0 of asdoc. Many of the new features are already good additions. Here I would like to report a small bug in the tabstat command when used with bysort prefix. The labels for different categories of bysort variable are misallocated. Can you please look into it?

      Comment


      • #4
        Meliesa: If you're reporting what you think is a bug in asdoc, then Attaullah Shah would surely expect to see your exact syntax and a reproducible example.

        If you're reporting what you think is a bug in tabstat, then that is an official command: people still expect your exact syntax and a reproducible example and it is best to start a new thread to discuss that.

        Comment


        • #5
          Sorry for not providing enough information. I am using version 2.0 of asdoc and I tried the following command

          sysuse nlsw88
          asdoc tabstat age, by( occupation) stat(N mean sd) replace

          Comment


          • #6
            Meliesa Martin the bug related to the tabstat - labels in asdoc version 2.0 has been fixed. Version 2.1 is now available on SSC. To update
            Code:
            ssc install asdoc, replace
            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


            • #7
              As promised in post #1 above, a blog entry is now available on how to make tables row by row using the option row of asdoc. The full blog entry can be accessed here https://fintechprofessor.com/2018/09...stata-ms-word/

              In the above blog post, I show how to create a customized table such as the one given below:
              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
                This is a awesomely and helpful tool, thank you for sharing it.

                Comment


                • #9
                  Thanks again for sharing this great tool and for the updates. It is now working perfectly.

                  Comment


                  • #10
                    I have been using asdoc for quite some time and found it to be working great with most of the commands that I use in my work. Recently, I tried option row as posted in post #7 above, I encounter a problem when there is a closing parenthesis inside the option row. Specifically, any data after a closing parenthesis is not considered. For example,
                    Code:
                    asdoc, row(Name, Year, Telephone(six digits),address) replace
                    In the above, the text address is not exported to the Word file. Any suggestion on?

                    Comment


                    • #11
                      In the blog post mentioned in #7 above, I replied to a comment and showed how to work around this issue. The short answer is that the closing parenthesis ")" is used as a parsing character in the option row. Therefore, asdoc cannot distinguish whether this character is a string or is meant to end the sequence of text supplied through option row. We can use brackets "[ ]" instead of parenthesis "( )" when we have to use them as a string. We shall use option btp to convert the brackets back to parentheses when the data is written to the file. So the following code works.

                      Code:
                       asdoc, row(Name, Year, Telephone[six digits],address) replace btp
                      Last edited by Attaullah Shah; 09 Oct 2018, 08:11.
                      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


                      • #12
                        Yes, this is what I was looking for. I somehow missed the comments section of the blog post. Thanks.

                        Comment


                        • #13
                          Hi All,

                          I am getting the following error while using asdoc:
                          (note: file Myfile.doc not found)
                          asdocreg(): 3301 subscript invalid
                          <istmt>: - function returned error
                          r(3301);

                          Any ideas about what is going wrong? Thanks.

                          Comment


                          • #14
                            Samiul Haque Can you please provide more details on this error. I would appreciate if you can :
                            1. Share a dataset that you are using. You can use dataex(from SSC) for sharing a sample of y our data
                            2. Provide the exact code that generated the above error.
                            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
                              Click image for larger version

Name:	asdoc.png
Views:	1
Size:	250.3 KB
ID:	1466469

                              @Attaullah Shah
                              This is basically the command that I am using, and the output that I am getting.

                              Comment

                              Working...
                              X