**[P] fvexpand** -- Expand factor varlists

__Syntax__

**fvexpand** [*varlist*] [*if*] [*in*]

*varlist* may contain factor variables and time-series operators; see
fvvarlist and tsvarlist.

__Description__

**fvexpand** expands a factor varlist to the corresponding expanded, specific
varlist. *varlist* may be general or specific and even may already be
expanded.

__Remarks__

An example of a general factor varlist is **mpg** **i.foreign**. The
corresponding specific factor varlist would be **mpg** **i(0 1)b0.foreign** if
**foreign** took on the values 0 and 1 in the data.

A specific factor varlist is specific with respect to a given problem,
which is to say, a given dataset and subsample. The specific varlist
identifies the values taken on by factor variables and the base.

Factor varlist **mpg** **i(0 1)b0.foreign** is specific. The same varlist could
be written as **mpg** **i0b.foreign** **i1.foreign**, so that is specific, too. The
first is unexpanded and specific. The second is expanded and specific.

**fvexpand** takes a general or specific (expanded or unexpanded) factor
varlist, along with an optional **if** or **in**, and returns a fully expanded,
specific varlist.

__Stored results__

**fvexpand** stores the following in **r()**:

Macros
**r(varlist)** the expanded, specific varlist
**r(fvops)** **true** if *varlist* contains factor variables
**r(tsops)** **true** if *varlist* contains time-series operators