Announcement

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

  • Export xtsum and tabstat into Microsoft Word

    Hi everybody!

    I am trying to export two tables (xtsum and tabstat) into Word, but I have not succeeded in exporting the whole displayed information for each of these two tables.


    I wonder if it is possible to export data from these commando with outreg2 function, for example? Or, if there is any other way?

    Thank you in advance!


  • #2
    asdoc (from SSC) can work with almost all Stata commands. It can export nicely formatted tables to MS word. I am posting a few examples from the help file of asdoc here.
    Code:
    * Install asdoc
    
           ssc install asdoc
           help asdoc
    
     * Example 1 : One variable, many stats, including t-statistics
       
            sysuse auto, clear
            asdoc tabstat price , stat(min max mean sd median p1 p99 tstat) replace
    
       * Example 2 : Many variables, one statistic
            `
            asdoc tabstat price mpg rep78 headroom trunk weight length foreign, stat( mean) replace
    
    *    Example 3: Many variables, many statistics
            `
            asdoc tabstat price mpg rep78 headroom trunk weight length foreign, stat( max mean sd median p1 p99 tstat) replace
    For exporting output from xtsum command, asdoc would use its generic routine. I shall work on adding more support for this command as the output from the generic routine for xtsum is not aesthetically appealing at the moment.
    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


    • #3
      Thank you very much for your useful answer!

      I wonder if it is possible to display and export "by (country)"?

      I have read and tried this:

      2.4 Summary statistics over a grouping variable:
      To find summary statistics separately for each category of a grouping
      variable, we can use by(varname) or the prefix bysort varname: with
      asdoc.

      Example 12 : For each category of foreign: display Mean SD, t-value 1st
      and 99th percentiles
      `
      sysuse auto, clear
      asdoc sum, stat(N mean sd tstat p1 p99) by(foreign)
      OR
      bys foreign: asdoc sum, stat(N mean sd tstat p1 p99)

      but it does not seem to work.

      Comment


      • #4
        When you say "It does not work", it is hardly any helpful. Please provide details on what does not work. Further, which operating system are you using, is it windows or MacOS?
        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


        • #5
          I am using MacOS, STATA version 15.1. The commands stated above create a file that is not possible to read whether the file is damaged or else.

          Comment


          • #6
            Sometimes macOS and Windows do not agree on what is counted as the carriage return. I have tried to resolve this issue in the next version of asdoc. The beta version is available on my website www.FinTechProfessor.com and can be downloaded from there.
            Code:
             * To completely uninstall the previous version
            net install uninstall_asdoc, from(http://fintechprofessor.com) replace
            uninstall_asdoc  
            
            * Now install the new version
            net install asdoc, from(http://fintechprofessor.com) replace
            Please post your comments on this new version.
            Additional note: Here are few videos on YouTube that show how asdoc can be used for exporting a variety of tables.
            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


            • #7
              The second option did not work for me. But, I will do what I can with the first option you posted.

              Thank you very much for your help

              Have a good one!

              Comment

              Working...
              X