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 [email protected]

    Support website: www.FinTechProfessor.com

  • Shadi Shad
    replied
    Originally posted by Attaullah Shah View Post
    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 [email protected]

    Support website: www.FinTechProfessor.com
    Dear Attaullah,

    I have been trying to get a proper table output with your excellent package and I am facing a problem. I would like to make the outcome table very easy to understand for the reader so I tried using the option "label" but since I use only dummy variable in my difference in difference model when I use the option "label" I only get "1" appearing as the name of all my dummies in the rows. I would like to know if there's a fix for this? Is there a way I could give proper names to my dummy variables in the rows in this case? And is there a way that I could change the order the labels that appear, i.e. the order of the rows? (in case there is actually a fix regarding the previous question) Because I would like my most important dummy to appear first. I assume one could change this by changing the order of variable names in the "keep" option. But I am not sure it if works similarly when trying to label the coefficients.

    Best,
    Shadi
    Last edited by Shadi Shad; 19 Apr 2023, 06:46.

    Leave a comment:


  • Konstantina Boutsioukou
    replied
    Hi all,

    is there a way to export also the first stage estimates?

    Best regards,
    Konstantina

    Leave a comment:


  • Konstantina Boutsioukou
    replied
    Hi all,

    is there a way to export also the first stage estimates?

    Best regards,
    Konstantina

    Leave a comment:


  • Attaullah Shah
    replied
    Quinn Ye It is difficult to modify the asdoc's pwcorr code. However, I can implement this in asdocx.

    Leave a comment:


  • Quinn Ye
    replied
    @Attaullah Shah Many of the management journal report mean and sd in the correlation matrix table. Is there any way to add the mean and sd collum in the "asdoc pwcrror" option?

    Leave a comment:


  • Janet Lewis
    replied
    Attaullah Shah I have found your asdoc command really useful for presenting various ttests in a single table. Could you please help me with a similar code to the one below however I want the chi2 stats an pvalues instead of ttest results. Thanks so much!

    Code:
    HTML Code:
    foreach v of varlist a b c d e f {
    asdoc ttest z, by(`v'), label abb(.) title(Associations) rowappend save(Table)
    }

    Leave a comment:


  • Attaullah Shah
    replied
    @Heike Krueger welcome to Statalist. The requested feature is not available in asdoc.

    Leave a comment:


  • Heike Krueger
    replied
    Dear all,

    I am running mixed models and I’m struggling with the Random-effects parameters: I would like to report var(_cons) and var(Residual) in my table using asdoc.
    However asdoc only reports lns1_1_1:_cons and lnsig_e:_cons.

    Is there a way to transform lns1_1_1:_cons and lnsig_e:_cons to get var(_cons) and var(Residual) for my output table? For example with a transformation option for the asdoc package?
    An option similar to what you can specify with the esttab ado?
    Code:
    esttab,  transform(ln*: exp(@)^2 exp(@)^2)
    Here is my code example, I'm using Stata 17:
    Code:
    mixed mood i.weekday || id:
    asdoc replay, replace nest
    Kind regards!

    Leave a comment:


  • Attaullah Shah
    replied
    Not available in asdoc, but can be added to asdocx.

    Leave a comment:


  • Pratap Pundir
    replied
    Is there a way to tell asdoc not to send SE rows to a regression nested table output? Somewhat like this:
    Click image for larger version

Name:	Picture1.png
Views:	1
Size:	117.8 KB
ID:	1641391


    Further, while this can be done easily manually, it would be nice to also be able to tell asdoc not to send the _cons row to the output.

    Leave a comment:


  • Attaullah Shah
    replied
    asdoc cor was not designed to handle such a large number of variables. The good news is that asdocx (premium version, see more details here https://fintechprofessor.com/asdocx/) can export to excel, supporting as many variables as your version of Stata may allow. See this example

    Code:
    * Some dummy data
    clear
    set obs 100
    forv i = 1 / 41 {
    gen prep`i' = uniform()
    }
    
    * Export correlation table of all variables starting with prep
    asdocx cor prep*, save(myfile.xlsx) replace
    Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	58.9 KB
ID:	1632812

    Leave a comment:


  • Nick Cox
    replied
    Thanks for adding detail. My impression is therefore that #180 can't be understood without the context added in #182. That's what it is. if so. You need an expert answer any way.

    Leave a comment:


  • Will Hall
    replied
    oh also, stata does this quite fine, except that the display output is impossible to single-column copy paste which is why I am exporting to word using asdoc

    Leave a comment:


  • Will Hall
    replied
    Thanks for replying Nick!

    In exporting .xls files to pdf, onto portrait page setup, the output is broken into multiple page sized results, without smashing the columns into single-digit width which is what asdoc is doing. So I don't need 45 colums all along one plane, I jut need to not have each column be one digit length, but, as in the "good" results screenshot, to be the width of the figure like 5 digits. All this is so I can copy paste the large columns somewhere - instead of copy pasting each cell.

    Leave a comment:

Working...
X