📄 mf_st_vartype.hlp
字号:
{smcl}
{* 28mar2004}{...}
{cmd:help mata st_vartype()}
{hline}
{* index st_vartype()}{...}
{* index st_isnumvar()}{...}
{* index st_isstrvar()}{...}
{title:Title}
{p 4 4 2}
{bf:[M-5] st_vartype() -- Storage type of Stata variable}
{title:Syntax}
{p 8 12 2}
{it:string scalar}
{cmd:st_vartype(}{it:scalar var}{cmd:)}
{p 8 12 2}
{it:real scalar}{bind: }
{cmd:st_isnumvar(}{it:scalar var}{cmd:)}
{p 8 12 2}
{it:real scalar}{bind: }
{cmd:st_isstrvar(}{it:scalar var}{cmd:)}
{p 4 4 2}
where {it:var} contains a Stata variable name or a Stata variable index.
{title:Description}
{p 4 4 2}
In all the functions, if {it:var} is specified as a name, abbreviations
are not allowed.
{p 4 4 2}
{cmd:st_vartype(}{it:var}{cmd:)}
returns the storage type of the {it:var}, such as {cmd:"float"},
{cmd:"double"}, {cmd:"str18"}, etc.
{p 4 4 2}
{cmd:st_isnumvar(}{it:var}{cmd:)}
returns 1 if {it:var} is a numeric variable and 0 otherwise.
{p 4 4 2}
{cmd:st_isstrvar(}{it:var}{cmd:)}
returns 1 if {it:var} is a string variable and 0 otherwise.
{title:Remarks}
{p 4 4 2}
{cmd:st_isstrvar(}{it:var}{cmd:)}
and
{cmd:st_isnumvar(}{it:var}{cmd:)}
are antonyms. Both functions are provided merely for convenience; they
tell you nothing that you cannot discover from
{cmd:st_vartype(}{it:var}{cmd:)}.
{title:Conformability}
{p 4 4 2}
{cmd:st_vartype(}{it:var}{cmd:)}:
{p_end}
{it:var}: 1 {it:x} 1
{it:result}: 1 {it:x} 1
{p 4 4 2}
{cmd:st_isnumvar(}{it:var}{cmd:)},
{cmd:st_isstrvar(}{it:var}{cmd:)}:
{p_end}
{it:var}: 1 {it:x} 1
{it:result}: 1 {it:x} 1
{title:Diagnostics}
{p 4 4 2}
All functions abort with error if {it:var} is not a valid Stata variable.
{title:Source code}
{p 4 4 2}
Functions are built-in.
{title:Also see}
{p 4 13 2}
Manual: {hi:[M-5] st_vartype()}
{p 4 13 2}
Online: help for
{bf:{help m4_stata:[M-4] stata}}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -