Home Forums ASDOC : Easy Publication Quality Tables in Stata Asdoc tabulate–showing statistics, rounding decimals

Tagged: , ,

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • Bernice S
    Guest
    Post count: 118

    Hi Dr. Attaullah Shah

    This is a wonderful addition to stata.

    I have an issue with chi2 not showing in the Word document and decimals not being adjusted. The statistic shows in the return window but not when the document opens. Also the decimal places I’d like to be rounded up to whole numbers. Here’s my sample:

    asdoc tabulate x y, nokey column chi2 dec(0) title(test) save(sample.doc), append

    I appreciate any suggestions you can offer!

    Bernice S
    Guest
    Post count: 118

    Also with tabstat the totals are shown in the return window but not in the document. Example below.

    asdoc tabstat x, by(y) stat(N mean) title (xx) save(x.doc), append
    Attaullah Shah
    Keymaster
    Post count: 69

    Currently, asdoc does not report additional statistics with tabulation commands. I am working on asdocx, a premium version of asdoc, which shall add all these missing functionalities. At the moment, there is a workaround for this issue. If you read the asdoc help file, you shall see in Section 1.9 that there is a text() option that can be used for reporting text or any additional statistics from the r() and e() macros. Since tabulation command leaves the Chi2 and its P-value in r() macros, therefore, they can be written to the existing document using the text option. See the following examples

    webuse citytemp2
    asdoc tabulate region agecat, chi2 replace
    asdoc, text(Chi2 =`r(chi2)'  Pr=`r(p)')
    Bernice S
    Guest
    Post count: 118

    Thank you so much!

    Prerak
    Guest
    Post count: 118

    Hi Sir,

    I have a problem while exporting using “asdoc table x y, c(mean z) row format(%12.2fc) save(results)”. When I open the exported documents, values are rounded off and not the exact ones that we can see on the output window. Could you please help me?

    Attaullah Shah
    Keymaster
    Post count: 69

    Prerak
    You can use option dec() to control the number of decimal points. See these examples

    Default: three decimal points

    sysuse auto
    asdoc table foreign rep78, c(mean price)

    Two decimal points

    sysuse auto
    asdoc table foreign rep78, c(mean price) dec(2)

    One decimal point

    sysuse auto
    asdoc table foreign rep78, c(mean price) dec(1)
    Prerak
    Guest
    Post count: 118

    Dear sir,

    The problem is not with decimal points, but with the values. So if the value is 412864.32 then it is rounding off to 413000. What should I do?

    Prerak
    Guest
    Post count: 118

    Sir,

    How to report the entire value of 197162336608 instead of 1.97e+11 while exporting using asdoc table x y, c(sum z) dec(2) format(%15.0g) row save(resultsx)

    Attaullah Shah
    Keymaster
    Post count: 69

    Parek
    This issue was fixed in the recent updates
    The new version of asdoc can be installed from my site. Copy and paste the following line in Stata and press enter.

    net install asdoc, from(http://fintechprofessor.com) replace

    Please note that the above line has to be copied in full. After installation of the new version, then restart Stata.

    Please do remember to cite asdoc. To cite:
    In-text citation
    Tables were created using asdoc, a Stata program written by Shah (2018).

    Bibliography
    Shah, A. (2018). ASDOC: Stata module to create high-quality tables in MS Word from Stata output. Statistical Software Components S458466, Boston College Department of Economics.

    Prerak
    Guest
    Post count: 118

    Hello Sir,

    I came across another bug while exporting tables using asdoc.
    When I use “row” option for a two-way table, the exported document should have the same “total” (last row in the table) values as shown in the output window (which is the same statistic for column variable across the entire dataset), but asdoc is summing up all values in other rows and putting sum value in the “total” row.

    Could you please look into this?

    Thanks,
    Prerak

    Attaullah Shah
    Keymaster
    Post count: 69

    Hello Prerak
    I have not understood your question. Please remember to quote a reproducible example. Here are the outputs from asdoc and Stata tab commands when using without asdoc.

    *Official tabulate example
    
        Repair |
        Record |       Car type
          1978 |  Domestic    Foreign |     Total
    -----------+----------------------+----------
             1 |         2          0 |         2 
               |    100.00       0.00 |    100.00 
    -----------+----------------------+----------
             2 |         8          0 |         8 
               |    100.00       0.00 |    100.00 
    -----------+----------------------+----------
             3 |        27          3 |        30 
               |     90.00      10.00 |    100.00 
    -----------+----------------------+----------
             4 |         9          9 |        18 
               |     50.00      50.00 |    100.00 
    -----------+----------------------+----------
             5 |         2          9 |        11 
               |     18.18      81.82 |    100.00 
    -----------+----------------------+----------
         Total |        48         21 |        69 
               |     69.57      30.43 |    100.00 
    
    *asdoc table
    asdoc tab rep78 foreign, replace row
    
    asdoc tabulate export to Word from Stata
    

    You can compare these outputs and tell me where do they differ?

    Prerak
    Guest
    Post count: 118

    Dear Sir,

    Please find the example attached below.

    sysuse auto, clear
    table make foreign, c(mean price) row 
    
    The ideal output should have
     
       Renault Le Car |              3,895
               Subaru |              3,798
        Toyota Celica |              5,899
       Toyota Corolla |              3,748
        Toyota Corona |              5,719
            VW Dasher |              7,140
            VW Diesel |              5,397
            VW Rabbit |              4,697
          VW Scirocco |              6,850
            Volvo 260 |             11,995
    
                Total |  6,072.4   6,384.7
    

    But when I use

    asdoc table make foreign, c(mean price) row save(abcd)
    
    Renault Le Car	| 	        3895
    Subaru		|               3798
    Toyota Celica	|	        5899
    Toyota Corolla	|	        3748
    Toyota Corona	|	        5719
    VW Dasher	|	        7140
    VW Diesel	|	        5397
    VW Rabbit	|	        4697
    VW Scirocco	|	        6850
    Volvo 260	|	        11995
    
    Total	        | 315766        140463
    

    Here, asdoc is summing up all values in corresponding columns and giving that sum value in Total instead of actual values from the output window.

    Please help me with the concern mentioned here.

    Thank you for your time.

    Attaullah Shah
    Keymaster
    Post count: 69

    Prerak
    I was investigating the issue in tabulate command, while your example now shows that it was related to the table command. I have fixed the issue now.
    The new version of asdoc can be installed from my site. Copy and paste the following line in Stata and press enter.

    net install asdoc, from(http://fintechprofessor.com) replace

    Please note that the above line has to be copied in full. After installation of the new version, then restart Stata.

    asdocx is now available
    It is now almost three years in developing asdoc and constantly adding features to it. With the addition of _docx and xl() classes to Stata, it is high time to add support for native docx and xlsx output to asdoc. Also, given that there exists a significant number of LaTeX users, asdoc should be able to create LaTeX documents. It gives me immense pleasure to annouce asdocx that is not only more flexible in making customized tables, but also creates documents in native docx, xlsx, rtf, and .tex formats. If you have enjoyed and find asdoc useful, please consider buying a copy of asdocx to support its development. You may like to check the details here

    Please do remember to cite asdoc. To cite:

    In-text citation
    Tables were created using asdoc, a Stata program written by Shah (2018).

    Bibliography
    Shah, A. (2018). ASDOC: Stata module to create high-quality tables in MS Word from Stata output. Statistical Software Components S458466, Boston College Department of Economics.

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.