Announcement

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

  • Error When Opening Do File

    Hi Everyone,

    Does anyone know what this error is? Corrupt file?
    I use STATA 14 and saved this file as a .do, everything worked fine for a while as I opened and closed it on numerous occasions. I opened it one day and got this as my do file. I opened it a variety of ways and it still gave me this. It is backed up to Box drive. I had to delete all contents and redo the entire do file. It worked a few days and I was able to save and open and close, I then received this message again. I deleted the entire file this time and pasted what I could into the do file from my log. I have been using this version of STATA for months and have not had this problem with any other files. At the same time, I had created another do file for a section section of what I was working on, saved with a similar name and in a similar place and have not had any issues with that one.

    It is saved as a do-file (.do).
    I use STATA 14.
    I have used the point and click method to save the do file as well as the save command (ran from the do file).
    I have tried to open it on three different computers.
    I have tried to open it from various access points on those computers.
    To edit do files I use the do file editor.

    Has anyone seen this before, or have an idea of what is happening?

    Thanks so much in advance for your help!



    Click image for larger version

Name:	error message.jpg
Views:	1
Size:	517.2 KB
ID:	1465177





  • #2
    What you show is a Stata dataset, not a Stata do-file. If you ran a "save" command, the output of help save tells us that it saves data in memory to disk. That is, suppose you are testing code contained in the file mycode.do. Running the Stata command
    Code:
    save mycode.do
    will not save the do-file you have open in the Do-file editor, but rather will save the data you have open in memory, overwriting your do-file mycode.do with a Stata dataset having the wrong suffix.

    To save the do-file open in the Do-file editor, you need to either use the "Save" icon on the Do-file editor window toolbar, or, while you have the Do-file editor window active, the File > Save item in Stata's menus, or else the keyboard shortcut for the menu item.

    Comment


    • #3
      That is precisely what William is explaining.

      The Stata command save only saves datasets to files with .dta format (even if they are assigned a different extension). It is of no use whatever for saving text files.

      You can "save" (ordinary sense) text files that you have edited from the do-file editor.

      Comment


      • #4
        In addition to the problem you raised, trying to change the status of a code file using a command within that file is a bad idea in any case.

        Comment


        • #5
          I believe that our team is in the same boat as the original poster. Based on what was said here, without a backup we need to re-create the program, is that correct?

          Comment

          Working...
          X