Stata 15 help for fvrevar

[R] fvrevar -- Factor-variables operator programming command

Syntax

fvrevar [varlist] [if] [in] [, substitute tsonly list stub(stub)]

You must tsset your data before using fvrevar if varlist contains time-series operators; see [TS] tsset.

Description

fvrevar creates a variable list that includes equivalent, temporary variables in place of the factor variables, interactions, or time-series-operated variables in varlist. The resulting variable list can be used by commands that do not otherwise support factor variables or time-series-operated variables. The resulting list also could be used in a program to speed execution at the cost of using more memory.

Options

substitute specifies that equivalent, temporary variables be substituted for any factor variables, interactions, or time-series-operated variables in varlist. substitute is the default action taken by fvrevar; you do not need to specify the option.

tsonly specifies that equivalent, temporary variables be substituted for only the time-series-operated variables in varlist.

list specifies that all factor-variable operators and time-series operators be removed from varlist and the resulting list of base variables be returned in r(varlist). No new variables are created with this option.

stub(stub) specifies that fvrevar generate named variables instead of temporary variables. The new variables will be named stub#.

Examples

Setup . sysuse auto

Describe the data . describe

Create five temporary variables containing the values for each level of factor variable rep78 . fvrevar i.rep78

Show contents of r(varlist) . display "`r(varlist)'"

Do not create temporary variables and only return the list corresponding to the unoperated base variable of i.rep78 . fvrevar i.rep78, list

Show contents of r(varlist) . display "`r(varlist)'"

Only create two temporary variables corresponding to levels 2 and 3 of factor variable rep78 . fvrevar i(2,3).rep78

Show contents of r(varlist) . display "`r(varlist)'"

Stored results

fvrevar stores the following in r():

Macros r(varlist) the modified variable list or list of base-variable names


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