Version of fvrevar generating permanent result variables
Syntax
fvprevar [varlist] [if] [in] , generate(stub) [ nolabel substitute tsonly list fast ]
You must tsset your data before using fvprevar if varlist contains time-series operators; see [TS] tsset.
Description
fvprevar is an extended version of fvrevar, which returns the generated result variables as permanent variables (instead of as temporary variables), with names prefixed with a user-specified stub.
Options
generate(stub) must be specified. It specifies a prefix, used to produce names for the generated variables, and suffixed by positive whole numbers from 1 to the number of generated variables.
nolabel specifies that no variable labels will be defined for the generated permanent result variables. If nolabel is not specified, then the generated permanent result variables will have variable labels equal to the variable characteristic varname[fvrevar], saved by fvprevar and fvrevar, containing the expanded name of the virtual factor variable corresponding to the generated variable.
substitute specifies that equivalent, permanent variables, with names prefixed using the generate() option, will be substituted for any expanded factor variables, interactions, or time-series-operated variables in the varlist. substitute is the default action taken by fvprevar; you do not need to specify the option.
tsonly specifies that results variables will 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. No new variables are created with this option.
fast is an option for programmers. It specifies that fvprevar will do no extra work to restore the original dataset (without the generated result variables) if the user presses Break.
Examples
Setup . sysuse auto, clear
Describe the data . describe
Create five variables b_1, b_2, b_3, b_4 and b_5, containing the values for each level of factor variable rep78
. fvprevar i.rep78, generate(b_) . describe b_*
Saved results
fvprevar saves the following in r():
Scalars r(ngenvar) Number of generated result variables
Macros r(varlist) the expanded variable list or list of base-variable names
fvprevar (like fvrevar) also sets, for each generated variable, the variable characteristic varname[fvrevar], containing the expanded virtual factor variable name for that generated variable.
Also see
Manual: [R] fvrevar
Help: [R] fvrevar, [TS] tsrevar, [P] syntax, [P] unab