Shift Values

Shift Values creates new variables that contain the values of existing variables from preceding or subsequent cases.

Name. Name for the new variable. This must be a name that does not already exist in the active dataset.

Get value from earlier case (lag). Get the value from a previous case in the active dataset. For example, with the default number of cases value of 1, each case for the new variable has the value of the original variable from the case that immediately precedes it.

Get value from following case (lead). Get the value from a subsequent case in the active dataset. For example, with the default number of cases value of 1, each case for the new variable has the value of the original variable from the next case.

Number of cases to shift. Get the value from the nth preceding or subsequent case, where n is the value specified. The value must be a non-negative integer.

To Create a New Variable with Shifted Values

  1. From the menus, choose:

    Transform > Shift Values

  2. Select the variable to use as the source of values for the new variable.
  3. Enter a name for the new variable.
  4. Select the shift method (lag or lead) and the number of cases to shift.
  5. Click Change.
  6. Repeat for each new variable you want to create.