Calculating time intervals
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.
- Click to display the Variables window.
- Click to add a new variable.
- To calculate the duration of waiting for each respondent, 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).
- Specify the Code Details to calculate the amount of time in seconds. The Not Asked value is specified to ensure that the calculation is only performed if data exists for the time question.
Code | Code Label | Value |
NA | Not Asked | Q1b Missing |
OK | Valid | Q1c-Q1b |
- Click to save the variable. The variable can then be used to produce a statistics table of the duration of wait.