📄 varlist.hlp
字号:
{smcl}
{* 25mar2005}{...}
{cmd:help varlist}
{hline}
{title:Title}
{hi:[U] 11.4 varlists}
{title:Description}
{pstd}
If you are interested in creating a variable list of new variables,
see {it:{help newvarlist}}.
{pstd}
A {it:varlist} is a list of variable names with blanks in between. There
are a number of shorthand conventions to reduce the amount of typing. For
instance:
{p 8 34 2}{cmd:myvar} {space 17} just one variable{p_end}
{p 8 34 2}{cmd:myvar thisvar thatvar} {space 1} three variables{p_end}
{p 8 34 2}{cmd:myvar*} {space 16} variables starting with {cmd:myvar}{p_end}
{p 8 34 2}{cmd:*var} {space 18} variables ending with {cmd:var}{p_end}
{p 8 34 2}{cmd:my*var} {space 16} variables starting with {cmd:my} & ending
with {cmd:var} with any number of other characters
between{p_end}
{p 8 34 2}{cmd:my~var} {space 16} a single variable starting with {cmd:my} &
ending with {cmd:var} with any number of other characters
between{p_end}
{p 8 34 2}{cmd:my?var} {space 16} variables starting with {cmd:my} & ending with
{cmd:var} with one other character between{p_end}
{p 8 34 2}{cmd:myvar1-myvar6} {space 9} {cmd:myvar1}, {cmd:myvar2}, ...,
{cmd:myvar6} (probably){p_end}
{p 8 34 2}{cmd:this-that} {space 13} variables {cmd:this} through {cmd:that},
inclusive{p_end}
{pstd}
The {cmd:*} character indicates to match one or more characters. All
variables matching the pattern are returned.
{pstd}
The {cmd:~} character also indicates to match one or more characters, but
unlike {cmd:*}, only one variable is allowed to match. If more than one
variable matches, an error message is presented.
{pstd}
The {cmd:?} character matches a single character. All variables matching
the pattern are returned.
{pstd}
The {cmd:-} character indicates that all variables in the dataset, starting
with the variable to the left of the {cmd:-} and ending with the variable to
the right of the {cmd:-} are to be returned.
{pstd}
Many commands understand the keyword {cmd:_all} to mean all variables.
Some commands default to using all variables if none are specified.
{pstd}
Time-series {it:varlists} are a variation on {it:varlists} of existing
variables. When a command allows a time-series {it:varlist}, you may include
time-series operators. For instance, {cmd:L.gnp} refers to the lagged value of
variable {cmd:gnp}. The time-series operators are
Operator{col 19}Meaning
{hline 57}
{cmd:L.}{col 19}lag (x_t-1)
{cmd:L2.}{col 19}2-period lag (x_t-2)
...
{cmd:F.}{col 19}lead (x_t+1)
{cmd:F2.}{col 19}2-period lead (x_t+2)
...
{cmd:D.}{col 19}difference (x_t - x_t-1)
{cmd:D2.}{col 19}difference of difference (x_t - 2x_t-1 + x_t-2)
...
{cmd:S.}{col 19}"seasonal" difference (x_t - x_t-1)
{cmd:S2.}{col 19}lag-2 (seasonal) difference (x_t - x_t-2)
...
{hline 57}
{pstd}
Time-series operators may be repeated and combined and both lowercase and
uppercase letters are understood. For more details see help {help tsvarlist}.
{title:Examples}
{phang}{cmd:. list region pop81 pop82 pop83}{p_end}
{phang}{cmd:. list region pop*}
{phang}{cmd:. regress y age race sex reg1 reg2 reg3 reg4 reg5 reg6}{p_end}
{phang}{cmd:. regress y age race sex reg1-reg6}
{phang}{cmd:. summarize popular_vote_99 population99 yearly_99_inc}{p_end}
{phang}{cmd:. summarize pop*99 y~99_inc}
{phang}{cmd:. summarize _all}{p_end}
{phang}{cmd:. summarize}
{phang}{cmd:. logit y inv93amt inv94amt inf95amt inv96amt}{p_end}
{phang}{cmd:. logit y inv9?amt}
{phang}{cmd:. tsset time}{p_end}
{phang}{cmd:. regress y x L.x F.x S12.x income age}
{title:Also see}
{psee}
Manual: {bf:[U] 11 Language syntax},{break}
{bf:[U] 11.2.3 Variable-name abbreviation},{break}
{bf:[U] 11.4 varlists}
{psee}
Online: {help language}, {help tsvarlist}, {help varname}, {help newvarlist};
{help numlist},
{help subscripting}, {helpb tsset}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -