How to Save a Modified Copy of an SPSS Data File
When working in Q, there are situations in which you may want to save a new copy of your data file. Some examples include:
- Removing variables – the file contains fields with personal data such as respondent name or e-mail address which need to be removed from the data file.
- Removing cases – the file contains respondents with incomplete data which you want to exclude from your analysis.
- Creating new variables – you want to hard-code a weight or some other variable that you’ve created in Q.
Remember that when you make these types of changes in your project, Q does not modify the underlying data file. In most cases, saving a new file is not necessary – your Q project will remember changes you make. Saving a new file can become relevant if you need to pass a modified copy of raw data on to a client or other third party. This post explains how to create a new SPSS data file which will save the changes you make.
Importing the original data file
Before making any changes to your data file, you should first open the file in Q, but without executing any of Q’s automated file setup procedures. This will prevent any unwanted changes to the data as a result of the setup automation. To load the original data file, first open a new instance of Q and select File > Data Sets > Add to Project > From File. Locate the SPSS data file on your hard drive and select Open.
Next, from Data Import window:
- Select Use original data file structure
- Expand the Advanced section and uncheck Tidy Up Variable Labels
- Uncheck Strip HTML from Labels
Click OK to start the import process. The file will then be imported into Q with the original file structure.
Making changes to your data file
The next step is to make the changes to the data file as needed.
- Delete variables – to remove a variable from your project, mark it as hidden by clicking the “H” tag on the Variables and Questions tab.
- Delete cases – individual cases can be deleted from the Data tab in Q or many records can be deleted at once. More details on this topic can be found in the blog post Tips for working in the Data tab.
Creating new the SPSS file
Once you’ve made the necessary edits you’re now ready to create the new SPSS file. To create the file, select Tools > Save Data as SPSS/CSV File. A prompt will appear which details how Q handles certain data when creating the SPSS file:
- Pick Any questions are exported as 1’s (selected) and 0’s (not selected).
- Recoded values are stored in place of the original values.
- Variable labels – any revised variable/value labels are used in place of the original labels.
- Hidden questions/variables are removed from the data file.
- Deleted cases are removed from the data file.
Note that any changes you’ve made to individual tables, such as merging or deleting rows, will not be merged or deleted in the new file.
Select a folder on your hard drive to save the new SPSS file, enter a file name, and click the Save button.
Check out this post for info on why Q is a faster alternative to SPSS.