help clear
-------------------------------------------------------------------------------
Title
[D] clear -- Clear memory
Syntax
clear
clear [ mata | results | matrix | programs | ado ]
clear [ all | * ]
Description
clear, by itself, removes data and value labels from memory and is
equivalent to typing
. version 11
. drop _all (see [D] drop)
. label drop _all (see [D] label)
clear mata removes Mata functions and objects from memory and is
equivalent to typing
. version 11
. mata: mata clear (see [M-3] mata clear)
clear results eliminates saved results from memory and is equivalent to
typing
. version 11
. return clear (see [P] return)
. ereturn clear (see [P] return)
. sreturn clear (see [P] return)
. _return drop _all (see [P] _return)
clear matrix eliminates from memory all matrices created by Stata's
matrix command; it does not eliminate Mata matrices from memory. clear
matrix is equivalent to typing
. version 11
. return clear (see [P] return)
. ereturn clear (see [P] return)
. sreturn clear (see [P] return)
. _return drop _all (see [P] _return)
. matrix drop _all (see [P] matrix utility)
. estimates drop _all (see [R] estimates)
clear programs eliminates all programs from memory and is equivalent to
typing
. version 11
. program drop _all (see [P] program)
clear ado eliminates all automatically loaded ado-file programs from
memory (but not programs defined interactively or by do-files). It is
equivalent to typing
. version 11
. program drop _allado (see [P] program)
clear all and clear * are synonyms. They remove all data, value labels,
matrices, scalars, constraints, clusters, saved results, sersets, and
Mata functions and objects from memory. They also close all open files
and postfiles, clear the class system, close any open Graph windows and
dialog boxes, drop all programs from memory, and reset all timers to
zero. They are equivalent to typing
. version 11
. drop _all (see [D] drop)
. label drop _all (see [D] label)
. matrix drop _all (see [P] matrix utility)
. scalar drop _all (see [P] scalar)
. constraint drop _all (see [R] constraint)
. cluster drop _all (see [MV] cluster utility)
. file close _all (see [P] file)
. postutil clear (see [P] postfile)
. _return drop _all (see [P] _return)
. discard (see [P] discard)
. program drop _all (see [P] program)
. timer clear (see [P] timer)
. mata: mata clear (see [M-3] mata clear)
Examples
---------------------------------------------------------------------------
Setup
. sysuse auto
. describe
. label list
Drop all data and value labels from memory
. clear
Show that data and value labels have been eliminated from memory
. describe
. label list
---------------------------------------------------------------------------
Setup
. sysuse auto
. regress price mpg rep78 foreign
. summarize price
. ereturn list
. return list
Eliminate saved results from memory
. clear results
Show that saved results have been eliminated from memory
. ereturn list
. return list
---------------------------------------------------------------------------
Also see
Manual: [D] clear
Help: [D] drop, [P] discard