See Crunch Automation basics for more information.
The RENAME command allows you to change the alias of variables. As noted in the previous section, it is a schema-changing command and cannot be run again after the first non-schema command subsequently runs.
Generally speaking, you don’t need to change aliases of variables, so you only need to do this if there's a good reason. A common reason is needing to align a dataset: for example, you run the same survey on two different survey platforms and then want to merge them together via an append. The aliases of the variables don’t align (e.g., the “Gender” question is d1 in the first survey and q1 in the second survey). Thus, the RENAME command allows you to fix the alignment in one of the datasets.
RENAME (alias, ..., alias | <alias-function>) TO (alias, ..., alias | <refunction>);
Use case
In the following example, we’ve imported the Core Trends Study SPSS file example. The variables display in the variable summaries view as seen in the following:
# Rename one alias
RENAME lang TO Language;
# Rename multiple aliases at a time
RENAME lang, cregion TO Language, Region;
RENAME ALL("numeric") TO SUFFIX(ALIAS, "_num");
RENAME LIKE("str_%") TO REMOVE_COMMON_PREFIX(ALIAS);
After Crunch Automation runs the script, the following appears in the variable summaries view: