How to Rename Variables
Variables created in Q can be renamed whereas variables that are in the original data file cannot be renamed (you can tell which is which by their color). The reason that Q does not let you rename the variable is because it never modifies the raw data file, so as to make things like data updating possible.
The work-a-round is to:
- Right-click on the variables and select Copy and Paste Variable(s) > Exact Copy.
- Rename the copies.
- (Optionally) Hide the original variables.
Creating a new data file with renamed variables
In some cases you may want to rename variables in the data file itself. This can be the case, for example, when updating a project with a new data file where a variable has been renamed in the new data file. It is almost always better to ask your data provider to make such changes in the data file for you as they will have specialised tools for the task. However, if you need to do this in Q you can:
- Select File > New Project.
- Select File > Data Sets > Add to Project > From File.
- In the Data Import Window:
- Select Use original data file structure.
- Untick Tidy Up Variable Labels and Strip HTML from Labels.
- Click OK.
- Follow the steps above to rename the relevant variables, making sure to hide the original variables.
- Use Tools > Save Data as SPSS/CSV File to save a new copy of the data file.
This will produce a new copy of the data file that reflects the changes that you have made to the variables.