## Overview

Surveys are typically fielded in waves, which are distinct periods of time in which answers are collected from respondents. From a data processing perspective, a wave is an entire dataset that is added to a tracking study. These are best represented as *Categorical* variables in Crunch (rather than d*ate/time* variables).

The following article describes how you can add additional metadata to your categorical variables so that they can be used in time plots and time series analysis.

## Why do I need categorical date variables?

You need categorical date variables for several reasons. Let's begin by discussing how survey information is captured.

The information relating to when a survey was done is captured in one of two ways:

- Membership to period is captured in a categorical variable.
- For example, Wave 1, Wave 2, Wave 3, or Quarter 1, Quarter 2, Quarter 3, and so on.

- The exact time of the interview is captured in a date/time variable.
- For example, you know the specific end-survey or start-survey time, e.g., 2012-01-03 23:00:20. It may not include the timestamp, just the date.

Date (including date/time) variables give precise time information about each case (respondent). That precision may be counter-productive if the exact dates don’t align neatly with your intended analysis. For example, fieldwork for Wave 3 runs between 2019-12-01 and completes on 2020-01-02, but you really only want to consider it as “the December wave” rather than “December give or take a few”.

This is where a categorical variable with dates associated is better suited to the analytic task, as you can clearly define *ranges* of time (as categories).

However, categorical variables on their own have no concept of time. There is nothing about a category called *Wave 1* or *Quarter 1* that tells us when the fieldwork occurred. As a result, categorical variables can’t be used for time plots (e.g., line charts, smoothers, or other time-series analyses). By changing the categorical variable to “Subtype: Date”, you can define a date that corresponds to each category. For example, *Wave 1* represents January 2020, with date “2020-01” and *Wave 2* represents 2020-02.

## How to add date metadata to categorical variables

You can create categorical wave variables using the Crunch web application, R, or with Crunch Automation.

### Using the Crunch web application

- Sign in to Crunch.
- Go to the
**Properties**of the categorical variable. - Change the 'Subtype' to
**Date**.*Instead of numeric values, there is an input field for***Date**.

- For each category, enter the desired date in the format YYYY-MM-DD. Alternatively, and more commonly, enter YYYY-MM to represent a month.
**Save**your variable.

### Using R

See the following dates(Categories)<- Crunch reference:

### Using Crunch Automation

Use the SET DATES command. See the following article for more information:

## What about date ‘rollup’ with categorical date variables?

Categorical date variables do not ‘roll up’ dates like date/time variables. With date/time variables, you can change the roll-up flexibly between day, week, month, year.

If you want to do a roll-up of your categorical variable, you can create a new categorical variable (e.g., using Combine Categories on the categorical variable) and then add the respective dates to the new variable as per the process described above.