This article is part of The Definitive Guide to Uploading and Preparing Data.
It is possible that after importing a data file, some variables could be encoded as the wrong variable type (e.g., a 1-10 scale variable is encoded as numeric when it should be a categorical (ordinal) scale). This is most common with CSV files (without corresponding JSON metadata) and occasionally with SPSS files as well.
If it is possible, try to set your variables to the correct type before they are encoded into a data file (e.g., an SPSS .sav file) before it is imported into Crunch. This will save time trying to convert them after importing.
Note: For tracking studies, you will need to ensure that consistent variables in both waves are aligned as the same type before you can append the data (merge waves). See the Definitive Guide to Tracking for more details.
In the web app
You can view a variable's type in the variable properties window, but you cannot change it there. It is recommended that any conversions of variable types be handled by Crunch Automation.
- REPLACE CONVERT command - Use this to change the type of the mentioned variable(s) to another type, overwriting the original.
- Note: REPLACE is a schema-changing command and must run at the top of the Crunch Automation script, as the first script on a dataset.
- CREATE CONVERT command - Use this when you do not want to or cannot alter a dataset’s schema, but instead want to create a new variable in the converted type.