Announcement

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

  • "Data in memory have changed" warning

    Does anyone know whether it's possible to disable the pop-up interface prompt that says "Data in memory have changed. Do you want to save the changes before exiting?" Since I always save files as needed using dofile syntax, I've always found this warning box somewhat annoying and unnecessary (since my answer always is "Don't save"). I'm guessing it can't be disabled from appearing, but thought I'd ask around to be sure.

  • #2
    As far as I know there is no way to disable it. And despite the regularity of your habits, reliance on human vigilance and consistency is always a recipe for failure. Someday, I promise, you will write a do-file and forget to save the final needed result, and perhaps this pop-up will save you from losing a lot of work.

    Comment


    • #3
      To Clyde's advice I will add the following, which may help in some circumstances.

      Let's assume you have a do-file that leaves in memory a dataset which has not been saved since it was created or changed. I think you are saying that the problem you describe arises when you quit Stata and Stata throws the confirmation dialog box you describe. Then here are two - make that three - different pieces of code you can add to your do-file before exiting to suppress the confirmation dialog box.

      1. Just clear the changed dataset if you are sure you won't ever want to use it after the do-file ends.
      Code:
      clear
      2. Save the changed dataset in a temporary dataset, that's enough to keep Stata happy when you exit and the temporary dataset will be discarded.
      Code:
      tempfile and_then_discard
      save "`and_then_discard'"
      3. Have Mata lie to Stata that the dataset has not been changed since last saved.
      Code:
      mata: st_updata(0)
      What these have in common is the purposive assertion on your part that the data do not need to be saved to disk. This reduces the number of "false positives" thrown by Stata about unchanged data, and so increases the likelihood that the ones you see deserve some thought before dismissing them.

      Comment


      • #4
        Many thanks to both of you.

        William, you diagnosed the situation precisely, and your suggestions are excellent. The clear option will work perfectly for me in all cases. Thanks again.

        Comment


        • #5
          I, for one, have dreamed for years that one day Stata will provide the option to disable this feature:
          - The downside of this feature for me is that I often need to spend extra neurons and time remembering to type in the clear option. Yes, it is a truly minimal annoyance and waste of time per instance, but it is also a very common instance, so it adds up over time.
          - The upside of this feature does not exist for me. This feature has never saved me once, and I expect it will never save me in the future. This is because in my field at least, it is important to preserve the "paper trail" from raw data to published results, for reproducibility, auditability, et cetera. Therefore, the appropriate habit for my field is to never save changes to the raw data; saving changes would actually be a serious mistake unless the original was preserved elsewhere.
          Last edited by Wei Hong; 06 Oct 2023, 09:52.

          Comment


          • #6
            Therefore, the appropriate habit for my field is to never save changes to the raw data; saving changes would actually be a serious mistake unless the original was preserved elsewhere.
            In fact, I recommend that once the original raw data file is created and saved, it should be made read-only. Alternatively, the source of the raw data and the code that imported it into Stata can be preserved and made read-only. I usually do both.

            Nevertheless, I find Stata's reminder about unsaved changed data to be very helpful. It has often saved me from losing hours of work-in-progress when an interruption in my day requires me to close Stata.

            Comment

            Working...
            X