How to Rename Variables

From Q
Jump to navigation Jump to search

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:

  1. Select File > New Project.
  2. Select File > Data Sets > Add to Project > From File.
  3. In the Data Import Window:
    1. Select Use original data file structure.
    2. Untick Tidy Up Variable Labels and Strip HTML from Labels.
    3. Click OK.
  4. Follow the steps above to rename the relevant variables, making sure to hide the original variables.
  5. 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.