Announcement

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

  • How to copy the output table in Stata to excel with the cell-by-cell format?

    When running this code,

    Code:
    esttab m1 m2 m3 m4 m5 m6,star(* 0.1 ** 0.05 *** 0.01) ar2 title(" dependent variable ") mtitle("w/o contr" "f&c_contr" "ind_contr" "ind*year_fe" "reg*year_fe" "non_US firms") keep(pt wFIRM_SIZE LNGDP UNEMPLOYMENT IMP_OVER_GDP INFLATION wLEVERAGE median_mtbv Herfindahl)

    I got the result as below

    Click image for larger version

Name:	1.PNG
Views:	1
Size:	23.5 KB
ID:	1617059



    I am wondering how to copy and paste it to the excel worksheet that cell by cell separately. I mean, the Table in excel should have 7 columns, 30 rows. I read this document about esttab (http://repec.org/bocode/e/estout/hlp_esttab.html), I have tried some options like csv, plain, fixed but it does not work. At this moment, when I use these options or the smcl default option, the result when pasting to Excel should be in one cell for the output of one row.
    For example, pt -0.0108*** -0.00383*** -0.00372*** -0.00336*** 0.000616 -0.00206 is displayed in one cell


  • #2
    estout is from SSC (FAQ Advice #12).

    Code:
    esttab m1 m2 m3 m4 m5 m6 using myfile.csv, star(* 0.1 ** 0.05 *** 0.01) ...

    Then look for a file named "myfile.csv" in your current directory.

    Comment


    • #3
      Originally posted by Andrew Musau View Post
      estout is from SSC (FAQ Advice #12).

      Code:
      esttab m1 m2 m3 m4 m5 m6 using myfile.csv, star(* 0.1 ** 0.05 *** 0.01) ...

      Then look for a file named "myfile.csv" in your current directory.
      Thank you so much, Andrew, can I ask what I should do when it notified such an error?

      file myfile.csv could not be opened
      r(603);

      Comment


      • #4
        Try and open it yourself from the folder. I usually open .csv files in Excel.

        Comment


        • #5
          Phuc,

          You'll have to change "myfile.csv" to an actual location on your computer using quotation marks. Suppose, for example, you had a Mac and wanted to save the file called "results.csv" on your desktop. You would enter:

          Code:
           
           esttab m1 m2 m3 m4 m5 m6 using "Users/Phuc/Desktop/results.csv", star(* 0.1 ** 0.05 *** 0.01) ...

          Comment

          Working...
          X