📄 newvarlist.hlp
字号:
{smcl}
{* 25mar2005}{...}
{cmd:help newvarlist}
{hline}
{title:Title}
{hi:[U] 11.4.2 Lists of new variables}
{title:Description}
{pstd}
A {it:newvarlist} is a list of new variables:
{p 8 12 2}
1. A {it:newvarlist} can literally be a list of one or more
{it:{help newvar:newvars}}, listed after another:
{cmd:x}
{cmd:x myvar inc92}
{p 8 12 2}
2. You may use a dash to specify a set of variables:
{cmd:p1-p90}{col 43}(means {cmd:p1 p2} ... {cmd:p90})
{cmd:inc90-inc99}{col 43}(means {cmd:inc90 inc91} ... {cmd:inc99})
{p 8 12 2}
3. You may specify a {it:{help data types:storage type}} of
{cmd:int},
{cmd:long},
{cmd:float},
{cmd:double},
or
{cmd:str}{it:#}
in front of any element of the list:
{cmd:double x}
{cmd:str2 name int myvar double inc92}
{p 8 12 2}
4. You may use parentheses to collect groups:
{cmd:double(x myvar inc92) int(p1-p90)}
{p 12 12 2}
The parentheses around {cmd:p1-p90} were not necessary, but
they make the meaning clearer.
{p 8 12 2}
5. When you do not specify the type, the default type -- which is usually
float -- is assumed:
{cmd:double x myvar inc92}{col 43}({cmd:myvar} and {cmd:inc92} will be float)
{p 12 12 2}
The default usually is float, but you can change it to double if you
wish; see {helpb set type}.
{pstd}
Because the default is float or double, you must specify {cmd:str}{it:#}
if you want to create a string variable.
Some commands understand {cmd:str} (without the number) and determine
the length themselves.
{title:Examples}
{phang}{cmd:. input x}
{phang}{cmd:. input x y z}
{phang}{cmd:. input double(x y z)}
{phang}{cmd:. input double(x y) str2 z}
{phang}{cmd:. generate str10 last = substr(name, 1, index(name, ",")-1)}
{phang}{cmd:. generate str last = substr(name, 1, index(name, ",")-1)}
{title:Also see}
{psee}
Manual: {bf:[U] 11 Language syntax},{break}
{bf:[U] 11.4.2 Lists of new variables}
{psee}
Online: {help language}, {help varname}, {help newvar}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -