📄 mf_st_varname.hlp
字号:
{smcl}
{* 23mar2005}{...}
{cmd:help mata st_varname()}
{hline}
{* index st_varname()}{...}
{title:Title}
{p 4 4 2}
{bf:[M-5] st_varname() -- Obtain variable names from variable indices}
P{title:Syntax}
{p 8 12 2}
{it:string rowvector}
{cmd:st_varname(}{it:real rowvector k}{cmd:)}
{p 8 12 2}
{it:string rowvector}
{cmd:st_varname(}{it:real rowvector k}{cmd:,}
{it:real scalar tsmap}{cmd:)}
{title:Description}
{p 4 4 2}
{cmd:st_varname(}{it:k}{cmd:)} returns the Stata variable names associated
with the variable indices stored in {it:k}. For instance, with the
automobile data in memory
{cmd:names = st_varname((1..3))}
{p 4 4 2}
results in {cmd:names} being ("make", "price", "mpg").
{p 4 4 2}
{cmd:st_varname(}{it:k}{cmd:,} {it:tsmap}{cmd:)} does the same thing, but
allows you to specify whether you want the actual or logical variable names
of any time-series operated variables created by the Mata function
{bf:{help mf_st_tsrevar:[M-5] st_tsrevar()}} or by the Stata command
{bf:{help tsrevar:[TS] tsrevar}}.
{p 4 4 2}
{cmd:st_varname(}{it:k}{cmd:)} is equivalent to {cmd:st_varname(}{it:k}{cmd:,}
{cmd:0)}; actual variable names are returned.
{p 4 4 2}
{cmd:st_varname(}{it:k}{cmd:, 1)} returns logical variable names.
{title:Remarks}
{p 4 4 2}
To understand the actions of {cmd:st_varname(}{it:k}{cmd:, 1)}, pretend
variable 58 was created by {cmd:st_tsrevar()}:
{cmd:k = st_tsrevar(("gnp", "r", "l.gnp"))}
{p 4 4 2}
Pretend {cmd:k} now contains (12, 5, 58). Variable 58 is a new, temporary
variable, containing {cmd:l.gnp} values. Where you to ask for the
actual names of the variables
{cmd:actualnames = st_varname(k)}
{p 4 4 2}
{cmd:actualnames} would contain
("gnp", "r", "__00004a"), although the name of the last variable
will vary because it is a temporary variable. Were you to ask for the
logical names
{cmd:logicalnames = st_varname(k, 1)}
{p 4 4 2}
you would get back ("gnp", "r", "L.gnp").
{title:Conformability}
{cmd:st_varname(}{it:k}, {it:tsmap}{cmd:)}
{it:k}: 1 {it:x c}
{it:tsmap}: 1 {it:x} 1
{it:result}: 1 {it:x c}
{title:Diagnostics}
{p 4 4 2}
{cmd:st_varname(}{it:k}{cmd:)} and
{cmd:st_varname(}{it:k}{cmd:,} {it:tsmap}{cmd:)}
abort with error if any element of {it:k} is
less than 1 or greater than {cmd:st_nvar()};
see {bf:{help mf_st_nvar:[M-5] st_nvar()}}.
{title:Source code}
{p 4 4 2}
Function is built-in.
{title:Also see}
{p 4 13 2}
Manual: {hi:[M-5] st_varname()}
{p 4 13 2}
Online: help for
{bf:{help mf_st_varindex:[M-5] st_varindex()}},
{bf:{help mf_st_tsrevar:[M-5] st_tsrevar()}};
{bf:{help m4_stata:[M-4] stata}}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -