Snap Desktop includes a number of operations and functions specifically designed to help analyse dates.
When a participant responds to a date response question they can enter a free format date. Examples of the date can include July 1st, 2020 or 1 Jul 20. The inbuilt operations enable date responses to be categorized by month, by day of the week or by custom specified ranges.
The following steps show how to create a derived variable which categorizes the response, to a date question, into quarters of the year.
Step 1: Create the derived variable
- Open the Variables window and click to add a new variable.
- In Name enter Quarter as the derived variable name.
Set the Type to Derived and Response to Single.
Step 2: Enter the date ranges
- In the Code list grid, enter Quarter 1 as the Label for the first quarter then in Values enter the date range Q1 >= 1 Jan 20 and Q1 < 1 Apr 20. Any appropriate date format can be used to specify the fixed dates.
- Repeat this for the other quarter date ranges.
- Alternatively, for this example we can use the MONTH function. This gives 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:
Using the MONTH function here produces a derived variable that works for every year. This method also takes advantage of the fact that for a derived single variable, only the upper bound for each code value needs to be specified so that any respondent in the previous code will already have been captured by that code.
Step 3: Using other built-in date functions
Other built-in functions that may be used for extracting information from dates are shown in the table.
the day of the week 1=Monday, 7=Sunday
a literal representing the name of the weekday, for example, “Wednesday”
the day of the month 1 to 28, 29, 30 or 31 as appropriate
the month of the year 1=January, 12=December
the name of the month, for example, “July”
the four-digit year, for example, 2020
You can 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 the way the month function was used in the previous example.
If there is a topic you would like a worksheet on, email to firstname.lastname@example.org