📄 mf_st_rclear.hlp
字号:
{smcl}
{* 28mar2005}{...}
{cmd:help mata st_rclear()}
{hline}
{* index st_rclear()}{...}
{* index st_eclear()}{...}
{* index st_sclear()}{...}
{* index stata r()-class results}{...}
{* index stata e()-class results}{...}
{* index stata s()-class results}{...}
{title:Title}
{p 4 4 2}
{bf:[M-5] st_rclear() -- Clear r(), e(), or s()}
{title:Syntax}
{p 8 12 2}
{it:void}
{cmd:st_rclear()}
{p 8 12 2}
{it:void}
{cmd:st_eclear()}
{p 8 12 2}
{it:void}
{cmd:st_sclear()}
{title:Description}
{p 4 4 2}
{cmd:st_rclear()} clears Stata's {cmd:r()} saved results.
{p 4 4 2}
{cmd:st_eclear()} clears Stata's {cmd:e()} saved results.
{p 4 4 2}
{cmd:st_sclear()} clears Stata's {cmd:s()} saved results.
{title:Remarks}
{p 4 4 2}
Returning results in {cmd:r()}, {cmd:e()}, or {cmd:s()} is one way
of communicating results calculated in Mata back to Stata;
see {bf:{help m1_ado:[M-1] ado}}.
See {bf:{help return:[R] saved results}} for a description of
{cmd:e()}, {cmd:r()}, and {cmd:s()}.
{p 4 4 2}
Use {cmd:st_rclear()}, {cmd:st_eclear()}, or {cmd:st_sclear()}
to clear results, and then use
{cmd:st_global()} to define macros,
{cmd:st_numscalar()} to define scalars,
and {cmd:st_matrix()} to define Stata matrices in {cmd:r()}, {cmd:e()},
or {cmd:s()}. For example,
{cmd:st_rclear()}
{cmd:st_global("r(name)", "tab")}{...}
{col 50}<- see {bf:{help mf_st_global:[M-5] st_global()}}
{cmd:st_numscalar("r(N)", n1+n2)}{...}
{col 50}<- see {bf:{help mf_st_numscalar:[M-5] st_numscalar()}}
{cmd:st_matrix("r(table)", X+Y)}{...}
{col 50}<- see {bf:{help mf_st_matrix:[M-5] st_matrix()}}
{p 4 4 2}
Is is not necessary to clear before saving, but it is considered good style
unless it is your intention to add to previously saved results.
{p 4 4 2}
If a saved result already exists, {cmd:st_global()}, {cmd:st_numscalar()},
and {cmd:st_matrix()} may be used to redefine it and even to redefine it to a
different type. For instance, continuing with our example, later in the same
code might appear
{cmd:if (}...{cmd:) {c -(}}
{cmd:st_matrix("r(name)", X)}
{cmd:{c )-}}
{p 4 4 2}
Saved result {cmd:r(name)} was previously defined as a macro containing "tab",
and, even so, can now be redefined to become a matrix.
{p 4 4 2}
If you want to eliminate a particular saved result, use {cmd:st_global()}
to change its contents to "":
{cmd:st_global("r(name)", "")}
{p 4 4 2}
Do this regardless of the type of the saved result. Note that in this
case, we use {cmd:st_global()} to clear saved result {cmd:r(name)},
which might be a macro and might be a matrix.
{title:Conformability}
{p 4 4 2}
{cmd:st_rclear()},
{cmd:st_eclear()},
{cmd:st_sclear()}
take no arguments and return void.
{title:Diagnostics}
{p 4 4 2}
{cmd:st_rclear()},
{cmd:st_eclear()},
{cmd:st_sclear()}
cannot fail.
{title:Source code}
{p 4 4 2}
Functions are built-in.
{title:Also see}
{p 4 13 2}
Manual: {hi:[M-5] st_rclear()}
{p 4 13 2}
Online: help for
{bf:{help mf_st_global:[M-5] st_global()}},
{bf:{help mf_st_numscalar:[M-5] st_numscalar()}},
{bf:{help mf_st_matrix:[M-5] st_matrix()}};
{bf:{help m4_stata:[M-4] stata}}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -