__Title__

**[P] set fvtrack** -- Keep track of levels for factor variables

__Syntax__

**set** **fvtrack** {**term** | **factor**} [**,** __perm__**anently**]

__Description__

**set** **fvtrack** allows you to control how Stata keeps track of factor levels
when you use factor-variables notation.

**contrast** behaves as if **set fvtrack factor** is in effect, regardless of the
current setting.

**menl** behaves as if **set fvtrack term** is in effect, regardless of the
current setting.

__Option__

**permanently** specifies that, in addition to making the change right now,
the setting be remembered and become the default setting when you
invoke Stata.

__Remarks__

Assume that we have the following factor variables:

Factor **ind** has 2 levels, taking on the values 0 and 1.

Factor **grp** has 3 levels, taking on the values 1, 2, and 3.

The expansion of **i.ind** is

**0b.ind** **1.ind**

The expansion of **i.grp** is

**1b.grp** **2.grp** **3.grp**

The expansion of their interaction **i.ind#i.grp** is

**0b.ind#1b.grp** **0b.ind#2.grp** **0b.ind#3.grp** **1.ind#1b.grp** **1.ind#2.grp**
**1.ind#3.grp**

When **set fvtrack factor** is in effect, or when it is implied by setting
**version, user** to a version less than 15, Stata keeps track of factor
levels with the factor variable. This means that specifying a level for
**grp** in one term will affect all other terms that contain **grp**. For
example, the expansion of

**i3.grp i.ind#i.grp**

is

**3.grp** **0b.ind#3.grp** **1.ind#3.grp**

and the expansion of

**i.grp i.ind#i3.grp**

is

**3.grp** **0b.ind#3.grp** **1.ind#3.grp**

When **set fvtrack term** is in effect, Stata keeps track of factor levels
with the term in which they are specified. This means that specifying a
level for **grp** in one term does not affect any other term that contains
**grp**. Using the above examples, we see that the expansion of

**i3.grp i.ind#i.grp**

is

**3.grp** **0b.ind#1b.grp** **0b.ind#2.grp** **0b.ind#3.grp** **1.ind#1b.grp**
**1.ind#2.grp** **1.ind#3.grp**

and the expansion of

**i.grp i.ind#i3.grp**

is

**1b.grp** **2.grp** **3.grp** **0b.ind#3.grp** **1.ind#3.grp**