Search code examples
stata

Exiting Stata without saving changes in data


I use the code below to load a dataset into memory:

use D:\d\all_vars_ready.dta , clear

Is there a way to prevent Stata from asking "save changes in data" before exiting?

Ideally, I would like to do this from within a do file.


Solution

  • The following works for me interactively:

    exit, clear
    

    This command will close Stata without asking to save any changes in the dataset.

    From within a do file, you also need to specify the STATA option:

    exit, clear STATA