Announcement

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

  • How to create a table by country and year and export it to Latex?

    Dear all,

    I created a table to display tax rates by year and country using the follwoing code: table country year1, c(mean carbontax)

    However, it is not possible to add a .tex command to export the table into Latex.

    Are there any other possibilites on how to create this table and use the tex command to export it into Latex?

    The code mentioned above delivers the following table:
    Click image for larger version

Name:	Table1.PNG
Views:	1
Size:	17.4 KB
ID:	1680583


    Thanks in advance!!

  • #2
    Which version of Stata are you using? In the new table system introduced in Stata 17, you would change this to something like
    Code:
    table (country) (year1), stat(mean carbontax)
    , and then you would be able to export to LaTeX using
    Code:
    collect export
    In previous versions of Stata, exporting to LaTeX was possible using a variety of community-contributed commands, for instance -esttab- or tabout
    Last edited by Hemanshu Kumar; 03 Sep 2022, 12:33.

    Comment


    • #3
      Thank you for answering. I am using Stata 16, I believe that the collect command only exists in Stata 17....

      Comment


      • #4
        I'm afraid the -table- command does not directly store its results (e.g. as a matrix) so that you can use it to export to LaTeX.

        As I mentioned before, you will probably want to use some community-contributed command. One option might be -tabout-, available via
        Code:
        net install tabout.pkg
        Once installed, your code might look something like:
        Code:
        tabout country year1 using mytable.tex, c(mean carbontax) sum style(tex) body

        Comment


        • #5
          Thank you very much, it worked perfectly!!

          Comment

          Working...
          X