This content describes Snap 11. For Snap 10, the equivalent page will be in Snap 10 help
These instructions tell you how to create variables to calculate the respondent's age from their date of birth and then put the respondents into age bands, based on the difference between a date of birth variable and the date function today. The instructions also apply if you have another date question in the questionnaire, which you want to use instead of today.
For this example, the date of birth variable is Q1. It assumes a four-digit year.
Name: Age
Label: Calculated age in years
Type: Derived (the variable will derive its data from other existing variables).
Response: Quantity (the response will be a numeric value for each case).
Code |
Code Label |
Value |
NA |
Not Asked |
Q1 Missing |
OK |
Valid |
(today-Q1a)\365.25 |
Note the use of \ to extract the whole number of years.
The Not Asked value is specified to ensure that the calculation is only performed if data exists for the date question.
Name: Agegroup
Label: Age groups
Type: Derived
Response: Single (each respondent will only fall into one of the new codes).
Code |
Code Label |
Value |
1 |
Up to 18 |
Age <= 18 |
2 |
19 to 24 |
Age <= 24 |
3 |
25 to 34 |
Age <= 34 |
4 |
35 to 44 |
Age <= 44 |
5 |
45 to 54 |
Age <= 54 |
6 |
55 to 64 |
Age <= 64 |
7 |
65 plus |
true |
The codes are assigned in order, so all responses that have not been sorted into previous bands appear as 65 plus.
See Also |