📄 _stubstar2names.hlp
字号:
{smcl}
{* 18mar2005}{...}
{cmd:help _stubstar2names}{right:also see: {help undocumented}}
{hline}
{title:Title}
{p 4 25 2}
{hi:_stubstar2names} {hline 2} Parsing new variable lists
{title:Syntax}
{phang2}
{cmd:_stubstar2names}
{it:new_var_spec}
{cmd:,}
{opt nvars(#)}
[
{opt zero}
{opt outcome}
{opt single:ok}
]
{phang}
where {it:new_var_spec} is either {it:newvarlist} or {it:stub}{cmd:*}; see
{help newvarlist}.
{title:Description}
{pstd}
{cmd:_stubstar2names} is a programmers tool that helps with parsing a
{it:newvarlist}, see help {it:newvarlist}. This tool requires the programmer
to specify how many new variable names are expected, and is willing to turn
{it:stub}{cmd:*} into a list of names that begin with {it:stub} and are
indexed by sequential integers.
{title:Options}
{phang}
{opt nvars(#)} is required, and specifies the number of new variable names.
{pmore}
If supplied with {it:newvarlist}, this option enforces that there are {it:#}
names in {it:newvarlist}.
{pmore}
If supplied with {it:stub}{cmd:*}, this option identifies how many names to
generate. By default, the names will be {it:stub}{cmd:1}, {it:stub}{cmd:2},
... {it:stub#}.
{phang}
{opt zero} indicates that the generated names start with {it:stub}{cmd:0}
instead of {it:stub}{cmd:1}. This option is only effective when
{cmd:_stubstar2names} is supplied with {it:stub}{cmd:*}.
{phang}
{opt outcome} modifies the error message produced when {it:new_var_spec} is a
{it:newvarlist} with the incorrect number of variables. By default, the error
message mentions "equations" and the {opt equation()} instead of "outcomes"
and the {opt outcome()}.
{phang}
{opt singleok} indicates that {it:new_var_spec} is allowed to contain a single
name, even if {it:#}>1 in the {opt nvars()} option.
{title:Examples}
{cmd}. _stubstar2names ex*, nvars(5)
{txt}
{cmd}. sreturn list
{txt}macros:
s(stub) : "{res}1{txt}"
s(typlist) : "{res}float float float float float{txt}"
s(varlist) : "{res}ex1 ex2 ex3 ex4 ex5{txt}"
{cmd}. _stubstar2names ex, nvars(5)
{err}too few variables specified
{txt}{search r(102):r(102);}
{cmd}. _stubstar2names ex, nvars(5) single
{txt}
{cmd}. sreturn list
{txt}macros:
s(stub) : "{res}0{txt}"
s(typlist) : "{res}float{txt}"
s(varlist) : "{res}ex{txt}"
{cmd}. _stubstar2names ex*, nvars(5) zero
{txt}
{cmd}. sreturn list
{txt}macros:
s(stub) : "{res}1{txt}"
s(typlist) : "{res}float float float float float{txt}"
s(varlist) : "{res}ex0 ex1 ex2 ex3 ex4{txt}"
{cmd}. _stubstar2names double ex*, nvars(5)
{txt}
{cmd}. sreturn list
{txt}macros:
s(stub) : "{res}1{txt}"
s(typlist) : "{res}double double double double double{txt}"
s(varlist) : "{res}ex1 ex2 ex3 ex4 ex5{txt}"
{cmd}. sysuse auto, clear
{txt}(1978 Automobile Data)
{cmd}. _stubstar2names ex1 ex2 ex3 mpg, nvars(4)
{err}mpg already defined
{txt}{search r(110):r(110);}
{title:Saved results}
{pstd}
{cmd:_stubstar2names} saves in {cmd:s()}:
{p2colset 9 25 32 2}{...}
{pstd}Macros:{p_end}
{p2col :{cmd:s(varlist)}}list of new variable names{p_end}
{p2col :{cmd:s(typlist)}}list of types for the new variables{p_end}
{p2col :{cmd:s(stub)}}{cmd:0},
or {cmd:1}; indicator for {it:stub}{cmd:*} in {it:new_var_spec}{p_end}
{title:Also see}
{psee}
Online:
{helpb syntax}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -