Announcement

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

  • How to import a table from stata to excel

    Hello I have the following table, I would like to import it to excel properly, without using copy and paste

    table ( state political_party) ( gender ) (), statistic(percent, across( gender))

  • #2
    In Stata 17, with the collect command available, this barely scratches the surface of the possibilities.
    Code:
    sysuse auto, clear
    table (foreign) (rep78) (), statistic(percent, across(rep78))
    collect export ~/Downloads/example.xlsx, replace
    Click image for larger version

Name:	example.png
Views:	1
Size:	71.9 KB
ID:	1702335

    Comment


    • #3
      Originally posted by William Lisowski View Post
      In Stata 17, with the collect command available, this barely scratches the surface of the possibilities.
      Code:
      sysuse auto, clear
      table (foreign) (rep78) (), statistic(percent, across(rep78))
      collect export ~/Downloads/example.xlsx, replace
      [ATTACH=CONFIG]n1702335[/ATTACH]
      I was able to generate it, but as my table is long I do not export all the data. Attempt 1 I export 20%, attempt 2 I export 5% of the table content.

      Comment


      • #4
        How long and wide is your table?

        How did you determine that only a fraction of your table was exported? Did Stata give you a message of some sort, or did you immediately open the output in Excel to see?

        Are you exporting your table to
        1. A file on a drive that is physically attached to the same system that Stata is running on?
        2. A file on a network drive that is mounted on the system that Stata is running on?
        3. A file on a cloud storage location (Dropbox, Google Docs, etc.)?
        For network drives and cloud storage, the operating system may first copy your file into a temporary location so your program can resume, and then copy it to the network or cloud destination. Statalist has many reports of problems similar to what you describe under these circumstances.

        In general, you should have Stata write your data using (1) if you plan on accessing the data within a very short time of its being written.

        Comment

        Working...
        X