Announcement

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

  • help with saving documents using etable

    When using etable I am unable to save the table I have created as a Word file (code below). I think it may have something to do with the fact that I have a brand new Macbook, with a brand new version of Word (?). I say this because this exact command works on my previous Macbook without any problem.

    Here is the code:

    etable, estimates(table1_all table1_dems table1_inds table1_reps) mstat(N) mstat(r2_a) showstars showstarsnote column(index) export("/Users/dcampbe4/Dropbox/Secularism Project/Penn State, Dortmound paper/table1.docx")

    When I run this, I receive this error message:

    option as() required; could not determine filetype from filename

    In experimenting with as(), I have not been able to figure out how to get it to work.

    Note that it will export a document if I simply use:
    export(table1.docx)

    While this is a work-around, I would prefer to be able to specify the location where it is saved.

    I would appreciate any guidance. Thank you!

  • #2
    Code:
    sysuse auto, clear
    eststo e1: reg price mpg turn
    etable, estimates(e1) export(testfile, as(docx))

    Comment


    • #3
      Thank you. I appreciate the help! However, while this code does save the table, I am still unable to save it to a specific folder. I tried this:
      etable, estimates(table1_all table1_dems table1_inds table1_reps) mstat(N) mstat(r2_a) showstars showstarsnote column(index) export("/Users/dcampbe4/Dropbox/Secularism Project/Penn State, Dortmound paper/table1.docx", as(docx))

      But received the error message: invalid 'as'

      Is it no longer possible to specify a folder? (It is a mystery why it saves the file where it does, as it is not the folder for the dataset or the do file I am using). Alternatively, is there some way that I can tell STATA where to save the table? I realize that I can manually move the table from one folder to another, but it seems like I should be able to save it there in the first place. And, indeed, I was able to do that when I first wrote this code on a different Macbook in June. (I should mention that my version of STATA is completely up to date).

      Again, I truly appreciate the assistance. I have been a STATA user for many years but have never been stumped like this.

      Comment


      • #4
        try this

        etable, estimates(table1_all table1_dems table1_inds table1_reps) mstat(N) mstat(r2_a) showstars showstarsnote column(index) export("./Users/dcampbe4/Dropbox/Secularism Project/Penn State, Dortmound paper/table1.docx", as(docx))

        Comment


        • #5
          David has found a parsing bug in etable's export() option. The file's path specification is being interpreted as more than one thing because of the spaces and comma, even though the path is quoted. We will fix this is a future update to Stata.

          The simplest work-around I can think of is to use the collect export command after calling etable, instead using the export() option of etable.

          Comment


          • #6
            Commenting on the off chance that my experience could help fix the bug as I encountered the same one. After some testing, it appears to be related to the string length or sequence and not the characters—I was able to make mine work by shortening the file name but not removing any special characters. Ultimately, following with the collect export command was precisely the solution I needed to retain my preferred file name. Thank you.

            Comment


            • #7
              The parsing of dtable's and etable's option export() was fixed in the Stata 18 update on 04sep2024.

              If you are still having trouble with this option, please write in to [email protected] with a reproducible example.

              Comment

              Working...
              X