Set Category Numeric Values or Dates
This article is part of The Definitive Guide to Importing and Preparing Data.
Category values should be defined when you would like to calculate and show means on a table (e.g., scale means). Often, imported variables will have a default numeric value, which you may choose to remove (or unset) since the mean of those categories is not needed (e.g., you may not need to show a mean value for gender).
Dates can be added to categorical variables so that the variable can be used to generate a time plot (See: Creating a date variable).
In the web app
- The Variable Properties panel for a categorical variable contains a dropdown for the subtype (Date, Scale, None) where you can then enter the values or dates for each category.
Crunch Automation
Using R
- See the Crunch Variables vignette for more information.
- For categories, use the Category() or Categories() functions and their related functions (e.g., names(categories(variable))).
- For values, use values() and its related functions (e.g., values(categories(variable))).