Announcement

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

  • Export the output of summarize to an excel

    What do you think is the more efficient way of doing so?

  • #2
    Please follow up on your earlier statement:

    18 Feb 2015, 15:45


    Thanks a lot everybody. Didn't know about the name thing, I'll change it immediately. sorry about that


    In terms of this thread:

    I'd say the question was too much of a puzzle. What does "efficient" mean here? Are you doing this once or repeatedly? Do you want just want a display or will the results be used in further analysis?

    Would text file output be enough? Do you want all the results of summarize?

    etc. etc.

    Last edited by Nick Cox; 23 Feb 2015, 08:06.

    Comment


    • #3
      I can't change the name.

      I just need it for presenting the summary, no further analysis needed. I would like all the results of summarize. I would like to export to excel.

      Comment


      • #4
        Real names: Yes, you can. Use the CONTACT US button at bottom right to send email to the administrators. FAQ Advice Section 6 also explains.

        Excel: On this information copy and paste seems to work as well as anything else for my students. Others may wish to bite.

        Comment


        • #5
          Sure, I'll bite.

          First, there are lots of resources that already exist that deals with the topic of exporting results from Stata to Excel. For example, see here: http://www.cpc.unc.edu/research/tool...orting_results

          If you just want the summary statistics, then copy and paste will work well. Better yet, make sure to highlight the summary output, right click, "Copy Table" and then paste in Excel. It might be formatted better.

          However, in case you wanted to programatically do it as well, you can also use the outreg2 command. You will need to install this from SSC.

          Code:
          clear
          Code:
          sysuse auto
          
          *Run a Regression on the variables you want summary statistics for
          *The regression results don't actually matter, just run it so that you can use outreg2 to pull summary stats
          reg price mpg rep78 headroom trunk weight length turn displacement gear_ratio foreign
          
          *Run outreg2
          *Specify "sum" to get summary statistics.
          outreg2 sum using myfile.xlsx

          Comment


          • #6
            Also, though it typically requires some extra programming, look at the -putexcel- command. And, for larger amounts of results, sometimes the best way is to create a tempfile containing them and then using -export excel-.

            I don't recommend the copy/paste mechanism, even for simple things, because 1) it is very easy to make a mousing error that omits material or includes extraneous material without realizing it, and 2) you have no audit trail of what you've done. If asked how you got the results in the Excel file, you would be unable to demonstrate it.

            Comment


            • #7
              Originally posted by Clyde Schechter View Post
              Also, though it typically requires some extra programming, look at the -putexcel- command. And, for larger amounts of results, sometimes the best way is to create a tempfile containing them and then using -export excel-.
              As a matter of fact, the use of summarize/regress and putexcel was covered in The Stata Daily, there is also very good article in The Stata Blog on that. A lot can be achieved by pushing the results to matrices and then exporting the whole thing. The lazy option would involve using logout (SSC) and simply passing the whole output to Excel.

              Kind regards,
              Konrad
              Version: Stata/IC 13.1

              Comment

              Working...
              X