Announcement

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

  • Generating and exporting summary table to Excel

    Hello, I am trying to produce a table that offers some summary statistics (Ns and %s, and averages, depending on whether the variable is binary or a count variable) broken down by a 1/0 categorical variable. The final product would look something like this:
    Everyone Category 0 Category 1
    Work N N N
    % % %
    Work2 N N N
    % % %
    Losses Average Average Average
    Average age Average Average Average

    I have tried using -asdoc- but it seems to only provide statistics by categories down the rows, instead of across the columns. I also tried creating a matrix and saving with putexcel but wasn't able to get that to work properly either. Any leads would be appreciated.


    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input byte(category work work2 losses age)
    1 1 0 0 14
    0 0 0 0 15
    0 0 1 0 14
    1 1 1 1 12
    0 1 1 0 16
    0 1 0 1 18
    0 0 1 0 18
    1 1 1 2 14
    1 1 1 0 12
    1 0 0 3 16
    1 0 1 0 18
    0 1 1 2 18
    0 1 1 1 14
    0 0 0 2 15
    1 0 1 4 15
    1 1 1 1 16
    0 1 1 2 10
    0 1 0 1 19
    1 0 1 0 20
    0 1 1 1 15
    end

  • #2
    You can use the row() option of asdoc to create the table row by row https://fintechprofessor.com/2018/09...stata-ms-word/. Or even better use flexmat of the asdocx.
    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
      Hi Taylor, there's a great command called table1_mc. It has a by option that allows you to prepare these summary tables fairly easily. Hope it helps. Let me know if you need help implementing it.
      ssc install table1_mc

      Comment

      Working...
      X