Announcement

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

  • Help with Tabout One-way table

    Hello,

    I would like to make a simple summary statistic table describing 3 merges. I just renamed the _merge variable that automatically gets generated _merge1 _merge2 _merge3. Essentially, what I would like to reproduce is a clean version of the merge statistics that are auto-generated by Stata, telling you how the matching went.

    I learned about tabout and have been reading many of the manuals. However, the results I am getting are incredibly ugly/nonsensical and I can't figure out why.

    For example, when I try

    Code:
    tabout _merge_1 _merge_2 _merge3 using "filepath/table.tex", replace ///
        style(tex) font(bold) oneway c(freq row) f(0c 1) ///
        clab(Count Col_%) npos(col) nlab(Sample) ///
    It doesn't render anything sensical -- see below . If I take out nlab(Sample), it doesn't render anything at all, but I don't get an error either (this has also happened a few other times -- there is no error, but no output gets created).

    Code:
    &Count&Col \%&Sample \\
    \hline
    \textbf{Merge 1}&&& \\
    Matched (3)&1000&100.0&1000 \\
    \textbf{Total}&1000&100.0&1000 \\
    \hline
    \textbf{Merge 2}&&& \\
    Master only (1)&3000&100.0&\3000
    Using only (2)&500&100.0&500 \\
    Matched (3)&20000&100.0&20000 \\
    \textbf{Total}&23500&100.0&23500 \\
    \textbf{Merge 3}&&& \\
    Master only (1)&40&100.0&40 \\
    Matched (3)&800&100.0&800\\
    \textbf{Total}&840&100.0&840 \\
    I'd also noticed that some of the options I was trying to use were not working. For example, from page 35 of the manual , I tried

    Code:
    sysuse auto, clear
    tabout foreign rep78 using table12.tex, replace ///
    style(tex) font(bold) sum npos(tufte) ///
    c(mean mpg mean weight mean length median price ///
    median headroom) f(1c 1c 1c 2cm 1c) h2(Mean Median) ///
    h2c(3 2) clab(MPG Weight_(lbs) Length_(in) Price ///
    Headroom_(in)) title(Table 12: Oneway summary table ///
    \\ with multiple summary measures) fn(Source: auto.dta)
    and I got errors "option twidth() not allowed" "option h2c() not allowed" "option title() not allowed". Same with fn(). When I remove these options, I get equally ugly output.

    Code:
    Mean Median
    &MPG&Weight (lbs)&Length (in)&Price&Headroom (in) \\
    \hline
    \textbf{Car origin}&&&&& \\
    Domestic (70\%)&19.8&3,317.1&196.1&\$4,782.50&3.5 \\
    Foreign (29\%)&24.8&2,315.9&168.5&\$5,759.00&2.5 \\
    \textbf{Total} (100\%)&21.3&3,019.5&187.9&\$5,006.50&3.0 \\
    \hline
    \textbf{Repair record 1978}&&&&& \\
    1 (2\%)&21.0&3,100.0&189.0&\$4,564.50&1.8 \\
    2 (11\%)&19.1&3,353.8&199.4&\$4,638.00&3.8 \\
    3 (43\%)&19.4&3,299.0&194.0&\$4,741.00&3.5 \\
    4 (26\%)&21.7&2,870.0&184.8&\$5,751.50&3.0 \\
    5 (15\%)&27.4&2,322.7&170.2&\$5,397.00&2.5 \\
    \textbf{Total} (100\%)&21.3&3,032.0&188.3&\$5,079.00&3.0 \\

    Does anyone have any advice? I am not sure what I am doing wrong. I tried ssc install tabout and I have the newest version. I also ran everything from here: http://tabout.net.au/downloads/main_version/tabout.txt

  • #2
    suffix .tex will lead you to TeX, try to use txt
    Code:
    tabout _merge1 _merge2 _merge3 using "filepath/table.txt"

    Comment


    • #3
      Hi Chen, thank you for your response. I tried this, and it gave me output, but not a formatted one.

      Code:
      syuse auto, clear 
       tabout foreign rep78 using table12.tex, replace
      
          Repair record 1978                    
      Car origin    1    2    3    4    5    Total
          No.    No.    No.    No.    No.    No.
      Domestic    2.0    8.0    27.0    9.0    2.0    48.0
      Foreign    0.0    0.0    3.0    9.0    9.0    21.0
      Total    2.0    8.0    30.0    18.0    11.0    69.0
      I'd also like a one-way table (i.e. not the variables against each other).

      Comment


      • #4
        Yes, that's it. You should copy and paste it to Excel to get formatted one. And I'm not sure which version of tabout you installed, Version 2 or Version 3? If you use Version 3, then try:
        Code:
        sysuse auto, clear
        tabout foreign rep78 using table1.xlsx, replace style(xlsx) oneway
        tabout foreign rep78 using table2.xlsx, replace style(xlsx)

        Comment


        • #5
          I'd like to use Latex rather than Excel to format -- is there no way to export it in a formatted way?

          Comment

          Working...
          X