Stata 15 help for discard
[P] discard -- Drop automatically loaded programs
discard drops all automatically loaded programs (see [U] 17.2 What is an
ado-file?); clears e(), r(), and s() stored results (see [P] return);
eliminates information stored by the most recent estimation command and
any other saved estimation results (see [P] ereturn); closes any open
graphs and drops all sersets (see [P] serset); clears all class
definitions and instances (see [P] classutil); clears all business
calendars (see [D] datetime business calendars); and closes all dialogs
and clears their remembered contents (see [P] dialog programming).
In short, discard causes Stata to forget everything current without
forgetting anything important, such as the data in memory.
Use discard to debug ado-files. Making a change to an ado-file will not
cause Stata to update its internal copy of the changed program. discard
clears all automatically loaded programs from memory, forcing Stata to
refresh its internal copies with the versions residing on disk.
Also all of Stata's estimation commands can display their previous output
when the command is typed without arguments. They achieve this by
storing information on the problem in memory. predict calculates various
statistics (predictions, residuals, influence statistics, etc.), estat
vce shows the covariance matrix, lincom calculates linear combinations of
estimated coefficients, and test and testnl perform hypotheses tests, all
using that stored information. discard eliminates that information,
making it appear as if you never fit the model.