Announcement

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

  • File damage

    Dear all,

    I am facing a serious problem with my datafile
    I usually use it normally

    I just today wanted to check something in the dataset I got shocked

    I got the following error notification
    ".dta file corrupt
    The file does not record <varnames> where expected. Either the file was written incorrectly in the
    first place or the file has become corrupted."

    I send the STATA company an email to help they asked the serial number of my STATA software
    I sent them but they replied me that my version it is a proper version ( As I got it from my Uni, I guess it is not a proper version).

    However, I need a help to recover this dataset.
    the reason for my urgent request is: I got revision from a decent journal so I must fix dataset

    Please anyone helps

  • #2
    Here is my advice.

    1. You might start by restarting your Stata instance and the computer itself, then seeing if you can open the file. You'd be surprised how many issues restarting can fix.

    2. Next, your best bet is a backup. Consider whether you have any backups for the data file. Does your institution keep a backup of your data drive? Are you on macOS and backing up regularly to iCloud? Did you ever email the data to someone or store it somewhere else?

    3. If you don't have a backup, you could try to open the file in software other than Stata, or run the file through a data file converter, converting to something simple like a .csv. It is possible that some third party has a more forgiving interpretation of what makes for a valid Stata file. You may still have an incomplete data file (missing variable names?) that you will need to fix by hand to get it working.

    4. If that doesn't work, your best bet is to regenerate the data file. If you started with open-access data and you still have your old script files this shouldn't be too hard. If you collected your own data, then you might need to go back through old notes, survey responses, or whatever.

    5. If there is no way to regenerate the data, you could try to reverse engineer the .dta data file. If you've gotten to this point, things are bad. If you are phenomenally lucky, a .dta is a compressed plain text file and you just need to find the correct decompression algorithm, learn the plain text format, and fix whatever is broken in the file. You could always try decompressing with some of the more common compression algorithms like .zip, .gz, .tar, etc. and see if you get plain text on the other side. If that doesn't work and you really want to continue on this quixotic quest, this guide looks pretty good as a starting point. The worst case scenario is probably that the file is compressed, but the compression wasn't completed correctly.

    Ultimately, the data may be (is probably) impossible to recover, especially without a substantial amount of time and highly specialized expertise. The big lesson here is that you should always back up your data. Also, keep in mind that something like this is most likely while writing to the drive, so take care about writes. Try to save data as infrequently as possible. When you transform the data during data management, keep the original data, the script you used to make the changes, and the resulting data. When you save data, don't exit Stata directly after running the save command. Give it a few seconds for the save to finish executing before you close Stata.

    Comment


    • #3
      Originally posted by Daniel Schaefer View Post
      Here is my advice.

      1. You might start by restarting your Stata instance and the computer itself, then seeing if you can open the file. You'd be surprised how many issues restarting can fix.

      2. Next, your best bet is a backup. Consider whether you have any backups for the data file. Does your institution keep a backup of your data drive? Are you on macOS and backing up regularly to iCloud? Did you ever email the data to someone or store it somewhere else?

      3. If you don't have a backup, you could try to open the file in software other than Stata, or run the file through a data file converter, converting to something simple like a .csv. It is possible that some third party has a more forgiving interpretation of what makes for a valid Stata file. You may still have an incomplete data file (missing variable names?) that you will need to fix by hand to get it working.

      4. If that doesn't work, your best bet is to regenerate the data file. If you started with open-access data and you still have your old script files this shouldn't be too hard. If you collected your own data, then you might need to go back through old notes, survey responses, or whatever.

      5. If there is no way to regenerate the data, you could try to reverse engineer the .dta data file. If you've gotten to this point, things are bad. If you are phenomenally lucky, a .dta is a compressed plain text file and you just need to find the correct decompression algorithm, learn the plain text format, and fix whatever is broken in the file. You could always try decompressing with some of the more common compression algorithms like .zip, .gz, .tar, etc. and see if you get plain text on the other side. If that doesn't work and you really want to continue on this quixotic quest, this guide looks pretty good as a starting point. The worst case scenario is probably that the file is compressed, but the compression wasn't completed correctly.

      Ultimately, the data may be (is probably) impossible to recover, especially without a substantial amount of time and highly specialized expertise. The big lesson here is that you should always back up your data. Also, keep in mind that something like this is most likely while writing to the drive, so take care about writes. Try to save data as infrequently as possible. When you transform the data during data management, keep the original data, the script you used to make the changes, and the resulting data. When you save data, don't exit Stata directly after running the save command. Give it a few seconds for the save to finish executing before you close Stata.
      thank you very much for such solutions


      I think I will try the third party software.
      I hope it works

      Comment

      Working...
      X