Skip to main content

Create

Create new variables from existing variables by doing arithmetic on them.

Create new variable menu

Type the desired variable name in the left-hand box and any valid R expression in the right-hand box. The expression can use existing variable names, arithmetic operators, and R functions.

Examples:

  • income = hours * payrate
  • weight.diff = end.weight - begin.weight
  • average.weight = (begin.weight + end.weight) / 2
  • bmi = weight / height^2

The new variable name is automatically converted to a valid name if needed (e.g., spaces replaced with dots).