Snap XMP Help

Analysing dates

< All Topics
image_pdfimage_print

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

  1. Open the Variables window  VariablesIcon.png and click  NewIcon.png  to add a new variable.
  2. In Name enter Quarter as the derived variable name.
  3. Set the Type to Derived and Response to Single.
    CreateDerivedVariable.PNG

Step 2: Enter the date ranges

  1. 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.
  2. Repeat this for the other quarter date ranges.
Code list defining the annual quarters
  1. 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:
Code list defining the annual quarters

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.

weekday

the day of the week 1=Monday, 7=Sunday

weekday name

a literal representing the name of the weekday, for example, “Wednesday”

day

the day of the month 1 to 28, 29, 30 or 31 as appropriate

month

the month of the year 1=January, 12=December

month name

the name of the month, for example, “July”

year

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 snapideas@snapsurveys.com

Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Contents