Snap includes a number of operations and functions specifically designed for help in analysing analyzingdates.

In Snap questionnaires, respondents reply to Date-response questions by entering a free-form date such as “July 1st, 2004” or “1 Jul 04”. Snap’s inbuilt operations enable those to be categorized by month, by day of the week or broken down into arbitrary ranges.

Given a date question, say, Q1 “When did you last visit?”, comparison operations may be used to construct a derived variable which categorizes the response into quarters of the year.

Step By Step

Step 1

Create a new variable called Quarter by going into the variables window – View | Variables | click the + icon to insert a new variable.
Variable Details | Quarter

Step 2

Set the Type to Derived and Response to Single.

Step 3

For the first quarter, specify the appropriate range of dates:

Q1 >= 1 Jan 04 and Q1 < 1 Apr 04

Any appropriate date format can be used to specify the fixed dates your are checking against.

In some circumstances, it is possible to simplify the specification. For this example we could have used Snap’s in-built month function to give us a number representing the month of the year (1=January, 12=December). Using that, we can set up the codes of the categorizing variable as follows:

Label Value
First Quarter Q1 month <= 3
Second Quarter Q1 month <= 6
Third Quarter Q1 month <= 9
Fourth Quarter Q1 month <= 12

We have simplified the specification by using the month function and by taking advantage of the fact that for a derived single variable, we only need to specify the upper bound for each code value (any respondent in the previous code will already have been captured by that code). Also note that this version will work regardless of the year the survey was conducted in.

Other built-in functions that may be used for extracting information from dates are:

Q1 weekday will give the day of the week (1=Monday, 7=Sunday)
Q1 weekday name will give a literal representing the name of the weekday (e.g. “Wednesday”)
Q1 day will give the day of the month (1 to 28, 29, 30 or 31 as appropriate)
Q1 month will give the month of the year (1=January, 12=December)
Q1 month name will give the name of the month (e.g. “July”)
Q1 year will give the four-digit year (e.g. 2004)

So it would be possible to build a similar derived variable to categorize replies according to the day of week (regardless of the month or the year) by using the weekday function in a similar way to our month function was used in the previous example.

If there is a topic you would like a worksheet on, email to