📄 program.hlp
字号:
{smcl}
{* 29mar2005}{...}
{cmd:help program}
{hline}
{title:Title}
{p2colset 5 20 22 2}{...}
{p2col :{hi:[P] program} {hline 2}}Define and manipulate programs{p_end}
{p2colreset}{...}
{title:Syntax}
{p 8 16 2}{cmdab:pr:ogram} [{cmdab:de:fine}] {it:pgmname} [{cmd:,}
[ {cmd:nclass} | {cmd:rclass} | {cmd:eclass} | {cmd:sclass} ]
{cmdab:by:able:(}{cmdab:r:ecall}[{cmd:,} {cmdab:noh:eader}] |
{cmdab:o:necall}{cmd:)}
{opt prop:erties(namelist)}
{cmdab:sort:preserve} {cmd:plugin}]
{cmdab:pr:ogram} {cmdab:di:r}
{p 8 16 2}{cmdab:pr:ogram} {cmd:drop} {c -(} {it:pgmname} [{it:pgmname} [...]] |
{cmd:_all} {c )-}
{p 8 16 2}{cmdab:pr:ogram} {cmdab:l:ist} [ {it:pgmname} [{it:pgmname} [...]] |
{cmd:_all}]
{title:Description}
{pstd}
{cmd:program define} defines and manipulates programs. {cmd:define} is
required if {it:pgmname} are any of the keywords: {cmd:define}, {cmd:dir},
{cmd:drop}, {cmd:list}, or {cmd:plugin}.
{pstd}
See {hi:[U] 18 Programming Stata} for a complete description of programs.
{title:Options}
{phang}
{cmd:nclass} states that the program being defined does not return
results in {hi:r()}, {hi:e()}, or {hi:s()} and is the default.
{phang}
{cmd:rclass} states that the program being defined returns results in
{hi:r()}. This is done using the {cmd:return} command; see {helpb return}.
If the program is not explicitly declared to be {cmd:rclass}, it may not
change or replace results in {hi:r()}.
{phang}
{cmd:eclass} states that the program being defined returns results in
{hi:e()} or modifies already existing results in {hi:e()}. This is done using
the {cmd:ereturn} command, see {helpb return} and {helpb ereturn}. If
the program is not explicitly declared to be {cmd:eclass}, then it may not
directly replace or change results in {hi:e()}
{phang}
{cmd:sclass} states that the program being defined returns results in
{hi:s()}. This is done using the {cmd:sreturn} command; see {helpb return}.
If the program is not explicitly declared to be {cmd:sclass}, then it may not
directly change or replace results in {hi:s()}, but it still may clear {hi:s()}
using `{cmd:sreturn clear}'.
{phang}
{cmd:byable(recall}[{cmd:,} {cmd:noheader}] | {cmd:onecall)} specifies that the
program allow Stata's {cmd:by} {it:varlist}{cmd::} prefix. There are
two styles for writing byable programs: {cmd:byable(recall)} and
{cmd:byable(onecall)}. The writing of byable programs is discussed in
{help byprog} and {hi:[P] byable}.
{phang}
{opt properties(namelist)} states that {it:pgmname} has the specified
properties. {it:namelist} may contain up to 80 characters,
including separating spaces. For more information see
{help program properties}.
{phang}
{cmd:sortpreserve} states that the program will change the sort order of
the data and that Stata is to restore the original sort order of the data
upon the program's conclusion. See {help byprog} and {hi:[P] sortpreserve}
for a discussion of this important option.
{phang}
{cmd:plugin} specifies that a plugin (a specially compiled C program) be
dynamically loaded and that the plugin define the new command; see
{help plugin}.
{title:Useful commands for programmers}
Basics
{p 8 28 2}{hi:[U] 18 Programming Stata}{p_end}
{p 8 28 2}{help byprog} {space 8} Making programs byable and sort preserving{p_end}
{p 8 28 2}{helpb macro} {space 9} Macro definition and manipulation{p_end}
{pstd}Parsing and program arguments{p_end}
{p 8 28 2}{helpb syntax} {space 8} Parse Stata syntax{p_end}
{p 8 28 2}{helpb confirm} {space 7} Argument verification{p_end}
{p 8 28 2}{helpb gettoken} {space 6} Low-level parsing{p_end}
{pstd}Program control{p_end}
{p 8 28 2}{helpb version} {space 7} Version control{p_end}
{p 8 28 2}{help ifcmd} {space 9} {cmd:if} programming command{p_end}
{p 8 28 2}{helpb foreach} {space 7} Looping{p_end}
{p 8 28 2}{helpb forvalues} {space 5} Looping{p_end}
{p 8 28 2}{helpb while} {space 9} Looping{p_end}
{p 8 28 2}{helpb continue} {space 6} Loop breaking{p_end}
{p 8 28 2}{helpb error} {space 9} Display generic error message and exit{p_end}
{p 8 28 2}{helpb exit} {space 10} Exit from program or do-file{p_end}
{p 8 28 2}{helpb capture} {space 7} Capture return code{p_end}
{pstd}Console output{p_end}
{p 8 28 2}{helpb display} {space 7} Display strings and values{p_end}
{p 8 28 2}{helpb tabdisp} {space 7} Display tables{p_end}
{pstd}Commonly used programming commands{p_end}
{p 8 28 2}{helpb return} {space 8} Return saved results{p_end}
{p 8 28 2}{helpb #delimit} {space 6} Change delimiter{p_end}
{p 8 28 2}{helpb quietly} {space 7} Quietly or noisily perform command{p_end}
{p 8 28 2}{helpb mark} {space 10} Mark observations for inclusion{p_end}
{p 8 28 2}{helpb matrix} {space 8} Matrix manipulation commands{p_end}
{p 8 28 2}{helpb preserve} {space 6} Preserve and restore data{p_end}
{p 8 28 2}{helpb scalar} {space 8} Scalar variables{p_end}
{pstd}Debugging{p_end}
{p 8 28 2}{helpb pause} {space 9} Program debugging command{p_end}
{p 8 28 2}{helpb trace} {space 9} {cmd:set trace} debugging command{p_end}
{pstd}Advanced programming commands{p_end}
{p 8 28 2}{helpb break} {space 9} Suppress Break key{p_end}
{p 8 28 2}{helpb char} {space 10} Characteristics{p_end}
{p 8 28 2}{helpb dialogs} {space 7} Dialog programming{p_end}
{p 8 28 2}{helpb _estimates} {space 4} Temp. preserve results from est. cmd.{p_end}
{p 8 28 2}{helpb ml} {space 12} Maximum-likelihood estimation{p_end}
{p 8 28 2}{helpb more} {space 10} Pause until a key is depressed{p_end}
{p 8 28 2}{helpb postfile} {space 6} Save results in Stata dataset{p_end}
{p 8 28 2}{helpb tokenize} {space 6} Divide strings into tokens{p_end}
{p 8 28 2}{helpb unab} {space 10} Unabbreviate variable list{p_end}
{p 8 28 2}{helpb window} {space 8} Programming menus, dialogs, and windows{p_end}
{title:Also see}
{psee}
Manual: {bf:[P] program}
{psee}
Online: {help adofile}, {helpb discard}, and table above
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -