Announcement

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

  • table out

    Hi all,

    I would like to show in a table the following, where y is a continous variable and regions and year are discrete vars

    table regions year, c(mean y)

    Which stata command shoud I use to create a publication-quality table? Thanks a lot.

  • #2
    What do you mean by publication quality table? Microsoft Word or Excel? Latex? I was recently reading:

    http://blog.stata.com/2017/01/10/cre...nd-formatting/

    Comment


    • #3
      esttab and outreg2 are user-written commands that are commonly used for this purpose. They are both great.

      Comment


      • #4
        Yes,I intend to output the table into excel or word. I am not sure that I am using outreg2 properly to output the 3 way table. If I type this
        table regions year, c(mean y)
        outreg2 using mymod.doc, replace: table nuts2 year, c(mean y)

        returns an error

        in alternative I used estout but the format is not that good

        set seed 123
        matrix A = matuniform(18,14)
        matrix list A
        estout matrix(A) using x.xls
        table nuts2 year, c(mean y) center col

        could you please help with that? Thanks

        Comment


        • #5
          For your -outreg2- issue you could run something more like this
          Code:
          bys nuts2 year: outreg2 using mymod.xls, replace sum(log) eqkeep (mean N) keep(y) excel
          -outreg2- doesn't understand -table- just because you put it after the colon. Be sure to read the help file and examples closely.


          I prefer to use -tabout- for these sorts of tables. Here's an example using your varnames from the OP with -tabout- and -outreg2-...for more on getting esttab to produce these tables consider the examples here: http://repec.sowi.unibe.ch/stata/est...criptives.html
          Code:
          sysuse auto, clear
          rename rep78 region
          rename foreign year
          rename mpg y
          
          table region year, c(mean y)
          
          tabout region year using table1.xls, replace ///
              sum c(mean y) 
              
             
          bys region year: outreg2 using table2.xls, replace sum(log) eqkeep (mean N) keep(y) excel
          By the way -outreg2- , -tabout- , and -esttab-/-estout- are from SSC.
          Eric A. Booth | Senior Director of Research | Far Harbor | Austin TX

          Comment


          • #6
            Thanks a million Eric!

            Comment


            • #7
              Hello,

              I need to export in excel the following tables in different sheets. Apparently tabout cannot provide an extraction of the results into different sheets.
              I have tried with putexcel and outreg2, but I am not able with the first and the second extract all the data in my dataset. COuld comebody help me with that?
              Here is my syntax

              table region year, c(mean b44) format(%9.1f) center

              example tabout
              tabout region year using table1.xls, app sum c(mean b44) format(2 1) ptotal(single)

              example outreg2

              bys year: outreg2 region b44 using myfile.xls, replace sum(log) eqkeep (obs) keep (b44)

              Thanks

              Comment

              Working...
              X