Announcement

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

  • export entire dataset to latex

    I have used `esttab` before to export regression results to Stata. However I have build a small table that I would like to export as it is:

    Code:
        * create a fake table with data to be exported to tex
        sysuse auto, clear
        keep make price mpg rep78 headroom
        keep if _n < 20
    Cross posted here.

  • #2
    You might want to have a look at the community contributed texsave (from SSC).
    Code:
    * create a fake table with data to be exported to tex
    sysuse auto, clear
    keep make price mpg rep78 headroom
    keep if _n < 20
    
    ssc install texsave
    texsave * using whatever.tex

    Comment


    • #3
      esttab is from SSC, as you are asked to explain (FAQ Advice #12).

      Code:
      sysuse auto, clear
      keep make price mpg rep78 headroom
      keep if _n < 20
      estpost tabstat price mpg rep78 headroom, by(make)
      esttab, cells("price mpg rep78 headroom") noobs nomtitle ///
      nonumber varlabels(`e(labels)') drop(Total) varwidth(30) ///
      collab(, lhs("`:var lab make'")) tex
      Res.:

      Code:
      {
      \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
      \begin{tabular}{l*{1}{cccc}}
      \hline\hline
      Make and Model                &       price&         mpg&       rep78&    headroom\\
      \hline
      AMC Concord                   &        4099&          22&           3&         2.5\\
      AMC Pacer                     &        4749&          17&           3&           3\\
      AMC Spirit                    &        3799&          22&           .&           3\\
      Buick Century                 &        4816&          20&           3&         4.5\\
      Buick Electra                 &        7827&          15&           4&           4\\
      Buick LeSabre                 &        5788&          18&           3&           4\\
      Buick Opel                    &        4453&          26&           .&           3\\
      Buick Regal                   &        5189&          20&           3&           2\\
      Buick Riviera                 &       10372&          16&           3&         3.5\\
      Buick Skylark                 &        4082&          19&           3&         3.5\\
      Cad. Deville                  &       11385&          14&           3&           4\\
      Cad. Eldorado                 &       14500&          14&           2&         3.5\\
      Cad. Seville                  &       15906&          21&           3&           3\\
      Chev. Chevette                &        3299&          29&           3&         2.5\\
      Chev. Impala                  &        5705&          16&           4&           4\\
      Chev. Malibu                  &        4504&          22&           3&         3.5\\
      Chev. Monte Carlo             &        5104&          22&           2&           2\\
      Chev. Monza                   &        3667&          24&           2&           2\\
      Chev. Nova                    &        3955&          19&           3&         3.5\\
      \hline\hline
      \end{tabular}
      }

      Comment

      Working...
      X