Stata 11 help for varlist

help varlist -------------------------------------------------------------------------------

Title

[U] 11.4 varlists

Description

If you are interested in creating a variable list of new variables, see newvarlist.

A varlist is a list of variable names with blanks between. There are several shorthand conventions to reduce the amount of typing. For instance:

myvar just one variable myvar thisvar thatvar three variables myvar* variables starting with myvar *var variables ending with var my*var variables starting with my & ending with var with any number of other characters between my~var one variable starting with my & ending with var with any number of other characters between my?var variables starting with my & ending with var with one other character between myvar1-myvar6 myvar1, myvar2, ..., myvar6 (probably) this-that variables this through that, inclusive

The * character indicates to match one or more characters. All variables matching the pattern are returned.

The ~ character also indicates to match one or more characters, but unlike *, only one variable is allowed to match. If more than one variable matches, an error message is presented.

The ? character matches one character. All variables matching the pattern are returned.

The - character indicates that all variables in the dataset, starting with the variable to the left of the - and ending with the variable to the right of the - are to be returned.

Many commands understand the keyword _all to mean all variables. Some commands default to using all variables if none are specified.

Factor variables are extensions of varlists of existing variables. When a command allows factor variables, in addition to typing variable names from your data, you can type factor variables using factor-variable operators.

Factor variables create indicator variables from categorical variables, interactions of indicators of categorical variables, interactions of categorical and continuous variables, and interactions of continuous variables (polynomials).

There are four factor-variable operators:

Operator Description -------------------------------------------------------------------- i. unary operator to specify indicators c. unary operator to treat as continuous # binary operator to specify interactions ## binary operator to specify factorial interactions --------------------------------------------------------------------

For complete syntax and usage of factor variables, see fvvarlist

Time-series varlists are a variation on varlists of existing variables. When a command allows a time-series varlist, you may include time-series operators. For instance, L.gnp refers to the lagged value of variable gnp. The time-series operators are

Operator Meaning --------------------------------------------------------- L. lag (x_t-1) L2. 2-period lag (x_t-2) ... F. lead (x_t+1) F2. 2-period lead (x_t+2) ... D. difference (x_t - x_t-1) D2. difference of difference (x_t - 2x_t-1 + x_t-2) ... S. "seasonal" difference (x_t - x_t-1) S2. lag-2 (seasonal) difference (x_t - x_t-2) ... ---------------------------------------------------------

Time-series operators may be repeated and combined and both lowercase and uppercase letters are understood. For more details see help tsvarlist.

Examples

. webuse census4 . describe

These 4 regress commands are equivalent . regress brate medage medagesq reg2 reg3 reg4 . regress brate medage medagesq reg2-reg4 . regress brate med* reg2-reg4 . regress brate medage c.medage#c.medage i.region

. summarize _all

. sysuse citytemp . describe

. summarize *dd . summarize temp* . summarize temp??? . summarize t*n

. webuse fvex . describe

. regress y distance i.group . regress y i.sex sex#c.distance

These 2 commands are equivalent . regress y distance i.sex i.group sex#group . regress y distance sex##group

Also see

Manual: [U] 11 Language syntax, [U] 11.2.3 Variable-name abbreviation, [U] 11.4 varlists

Help: [U] 11 Language syntax, [U] 11.1.8 numlist, [U] 11.4 varlists (varname), [U] 11.4.2 Lists of new variables; [U] 11.4.4 Time-series varlists, [U] 13.7 Explicit subscripting, [TS] tsset


© Copyright 1996–2009 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index