It's not possible to specify column comparisons using date variables. It's also not possible to have irregular dates (e.g., one column representing a year, a second column representing a variable). These can be achieved by creating an ordinal (or nominal) variable from the date variable.
- Familiarity with the Structure and Value Attributes of Variable Sets.
Method 1: Change the structure
The simplest approach is to click on the date/time variable and change its Structure to Ordinal. This will create a new category for every unique date/time value. Often this leads to too many categories to be useful.
Method 2: Create a custom R variable
- Select the date/time variable and press Date/Time in the object inspector and modify the settings. For example, if you want to create months and quarters, you would set Aggregation to 1 Month.
- Press OK.
- Hover where you wish to insert the new variable into the data set and press + > Custom Code > R - Numeric.
- In the R CODE box, type attr(, "QDate").
- Place your cursor to the left of the comma and click on the Date/Time variable in the data set, which will insert the name of the date/time variable. E.g., attr(`Interview Date`,"QDate").
- Change the Structure of the new variable to Nominal.
Article is closed for comments.