Announcement

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

  • Table of descriptive statistics for word

    Hi,

    to export the table of descriptive statistics I am using the "asdoc" command. With this command, I only receive the mean, standard deviation, min and max values of my variables. But I also want to show the median of my choosen variables. So far I tried:


    "asdoc sum leverage1 leverage2 leverage3 leverage5 leverage4 logAssets Tangibility1 Liquidity Profitability Growth Revenues_w if post==0,stat(mean sd p50) append title(Descriptive Statistics) save(Descriptive Statistics.doc)"

    With this command, I only get the values at the 1st and 99th percentile. I am confused how to solve this issue.


  • #2
    Guest:
    you can take advantage of the -table- suite:
    Code:
    . use "C:\Program Files\Stata18\ado\base\a\auto.dta"
    (1978 automobile data)
    
    . table (var) ( foreign ), stat(mean rep78 ) statistic(sd rep78 ) statistic(median rep78 )
    
    ------------------------------------------------------
                         |            Car origin          
                         |  Domestic    Foreign      Total
    ---------------------+--------------------------------
    Repair record 1978   |                                
      Mean               |  3.020833   4.285714   3.405797
      Standard deviation |   .837666   .7171372   .9899323
      Median             |         3          4          3
    ------------------------------------------------------
    
    . table (var) ( foreign ), stat(mean rep78 ) statistic(sd rep78 ) statistic(median rep78 )  statistic(iqr rep78 )
    
    -------------------------------------------------------
                          |            Car origin          
                          |  Domestic    Foreign      Total
    ----------------------+--------------------------------
    Repair record 1978    |                                
      Mean                |  3.020833   4.285714   3.405797
      Standard deviation  |   .837666   .7171372   .9899323
      Median              |         3          4          3
      Interquartile range |         0          1          1
    -------------------------------------------------------
    
    . putdocx begin
    
    . putdocx collect
    
    
    . putdocx save Stata_Table_Example, replace
    
    
    .
    Last edited by sladmin; 15 Mar 2024, 09:00. Reason: anonymize original poster
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      In addition to Carlo's extremely accurate and excellent advice, you may want to check the dtable command if you are using Stata18.

      Comment


      • #4
        Thank you Carlo and Maxence! Both advices were very helpful.

        Comment


        • #5
          To report custom summary statistics, use the option stat() and supply the required statistics inside the stat() option, see more on this on the asdoc web page. Here is one example:
          Code:
          sysuse auto
          asdoc sum price mpg rep78 headroom, stat(p1 mean sd p50 p99)
          Click image for larger version

Name:	Capture.JPG
Views:	1
Size:	46.8 KB
ID:	1745243
          Regards
          --------------------------------------------------
          Attaullah Shah, PhD.
          Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
          FinTechProfessor.com
          https://asdocx.com
          Check out my asdoc program, which sends outputs to MS Word.
          For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

          Comment

          Working...
          X