Adding a Duration to a Date

You can add or subtract durations, such as 10 days or 12 months, to a date. Continuing with the example of the software company from the previous section, consider determining the date on which each customer's initial tech support contract ends. The data file upgrade.sav contains a variable for the number of years of contracted support and a variable for the initial purchase date. You can then determine the end date of the initial support by adding years of support to the purchase date.

To add a duration to a date:

  1. Select Calculate with dates and times on the introduction screen of the Date and Time Wizard and click Next.
  2. In step 1, select Add or subtract a duration from a date and click Next.
    Figure 1. Adding a duration to a date: Step 2
    Adding a duration to a date: Step 2
  3. Select Date of initial product license for Date.
  4. In step 2, select Years of tech support for the Duration Variable.

    Since Years of tech support is simply a numeric variable, you need to indicate the units to use when adding this variable as a duration.

  5. Select Years from the Units drop-down list.
  6. Click Next.
  7. In step 3, enter SupEndDate for the name of the result variable. Result variables cannot have the same name as an existing variable.
  8. Enter End date for support as the label for the result variable. Variable labels for result variables are optional.
  9. Click Finish to create the new variable.

The new variable is displayed in the Data Editor.