help exit
-------------------------------------------------------------------------------
Title
[R] exit -- Exit Stata
[P] exit -- Exit from a program or do-file
Syntax
exit [[=]exp] [, options]
options description
-------------------------------------------------------------------------
clear exit Stata, even if the current dataset has not been saved
STATA exit Stata and return control to operating system
noprefs do not save preference changes upon exit; Unix(GUI) only
-------------------------------------------------------------------------
Description
Typing exit causes Stata to stop processing and return control to the
operating system. If the dataset in memory has changed since the last
save command, you must specify the clear option before Stata will let you
exit.
More generally, exit causes Stata to terminate the current process and
return control to the calling process. The return code is set to the
value of the expression or to zero if no expression is specified.
Options
clear permits you to exit, even if the current dataset has not been
saved.
STATA exits Stata and returns control to the operating system, even when
given from a do-file or program. The STATA option is implied when
exit is issued from the keyboard.
noprefs, available only for Unix(GUI), indicates that any preference
changes are to be ignored upon exit. The default is to save the
preferences when Stata is exited.
Remarks
Caution should be used if exit is included to break execution within a
loop. A more suitable command is continue or continue, break. continue
is used to explicitly break execution of the current loop iteration with
execution resuming at the top of the loop unless the break option is
specified, in which case execution resumes with the command following the
looping command.
Examples
---------------------------------------------------------------------------
Setup
. sysuse auto
. regress price mpg rep78 foreign
Exit Stata
. exit
---------------------------------------------------------------------------
Setup
. sysuse auto
. drop if rep78==.
Exit Stata even though dataset has changed and has not been saved
. exit, clear
---------------------------------------------------------------------------
Also see
Manual: [R] exit,
[P] exit
Help: [P] capture, [P] class exit, [P] error, [P] continue