help genicv

Title

genicv -- Generate interaction between continuous (or dummy)
variables

Syntax

genicv varlist [if] [in] [, options]

replace replace existing variables

x(chars) use chars as separator in variable labels

sepvars(chars) use chars as separator for variable names

mvc(mvc) replace interactions with mvc if variables have hard
missings

local(macname) save created variable names in macname

Description

genicv multiplies variables to create two or three-way interactions. If two variables
are specified in varlist, one new variable varname1_varname2 is created as the
product of var1 and var2. If three variables are specified, genicv creates
varname1_varname2_varname3 and all three two-way interactions (varname1_varname2,
varname1_varname3, varname2_varname3). If all variables in varlist are
labeled, new variable labels will be "labeli * labelj [* labelk]". If one or
more variables in varlist are not labeled, new variables will not be labeled.

Options

options

replace replaces existing variables. Default is to only create variables, that do not
yet exist.

sepvars(chars) use varnameicharsvarnamej
[charsvarnamek] as variable names. Default is "_".

x(chars) use labeli chars labelj [chars labelk] as
variable labels. Default is "*".

mvc(mvc) replaces interactions with hard missing mvc (where mvc is one
of .a, ..., .z), if one of the original variables has hard missings.

local(macname) saves the created variable names in r(macname). Default
macname is icv.

Example

. sysuse nlsw88 ,clear
(NLSW, 1988 extract)

. genicv wage age married

. describe

[...]
----------------------------------------------------------------------------
[...] value
variable name [...] label variable label
----------------------------------------------------------------------------
[...]
age age in current year
[...]
married marlbl married
[...]
wage hourly wage
[...]
wage_age hourly wage * age in current year
wage_married hourly wage * married
age_married age in current year * married
wage_age_marr~d hourly wage * age in current year * married
----------------------------------------------------------------------------

Saved results

genicv saves the following in r():

Macros

r(macname) created variable names

Author

Daniel Klein, University of Bamberg, klein.daniel.81@gmail.com

Also see

Online: generate, xi, fvvarlist

if installed: tuples, selectvars, chm