This content describes Snap 11. For Snap 10, the equivalent page will be in Snap 10 help

Next Topic

Book Contents

Book Index

Calculating the interval between two times using time variables

Listed below are the instructions for creating variables to calculate an amount of time, such as duration of a wait and then put the figure into a time period, based on the difference between a time of arrival variable and a time of departure variable.

Data will have already been entered into the questionnaires, including answers to the time variables (the variables must have a response type of Time). For this example, Q1b is the time of arrival and Q1c is the time of departure.

  1. To calculate the duration of wait of each respondent, create a new variable New button, and specify the Variable Details as:

    Name: Wait

    Label: Duration of time

    Type: Derived (the variable will derive its data from other existing variables).

    Response: Quantity (the response will be a numeric value for each case).

  2. Specify the Code Details to calculate the amount of time in seconds:

    Code

    Code Label

    Value

    NA

    Not Asked

    Q1b Missing

    OK

    Valid

    Q1c-Q1b

  3. Click Save button to save the variable. The variable can then be used to produce a statistics table of the duration of wait.

    The Not Asked value is specified to ensure that the calculation is only performed if data exists for the time question.

  1. To then band the waiting time into time slots, such as 30 minutes, 1 hour, 2 hours, create a new variable:

Name: Waittime

Label: Duration of stay

Type: Numeric (the variable specifies numeric values).

Response: Single (each respondent will only fall into one of the new codes).

  1. To access the source field, click on Variable definitions button. Enter Wait as the Source (this is the name of the derived variable we have just set up above).

  2. Specify the Code Details:

    Code

    Code Label

    Value

    1

    Under 30 minutes

    0 to 1799

    2

    30-60 minutes

    1800 to 3659

    3

    1-2 hours

    3660 to 7259

    4

    2-3 hours

    7260 to 10859

    5

    3-4 hours

    10860 to 14399

    6

    Over 4 hours

    14400 to 999999

  3. Click Save button to save the variable. The variable can then be used in tables and charts in the usual way.

See Also

Using time data

Time format examples

Time Functions

Categorising time responses using a single derived variable

Categorising time responses using a time function