Copying Data Properties
Metadata attributes associated with a data file—variable and value labels, missing value definitions, etc.—are saved with the data file.
Normally, you have to re-create this information every time you start to work on a new data file. To save time, you can copy variable settings from any saved IBM® SPSS® Statistics data file. This process works by applying the variable and file properties from one file to the currently active dataset.
You can use this method to:
- Create new variables in the active dataset based on variables in the external source data file.
- Apply variable properties from the external data file to variables with the same names in the active dataset.
- Apply selected variable properties (for example, defined value labels) from one variable in the external data file or the active dataset to multiple target variables in the active dataset.
In this example, we'll start with a data file that already has a few variables but without any defined variable properties for those variables.
- From the menus choose:
- Open smalldemo.sav. See the topic Sample Files for more
information.
Currently, the five variables in this file have the default properties.
- From the menus in the Data Editor window choose:
- In the Copy Data Properties Wizard, if it's not already selected,
click An external IBM SPSS Statistics data
file and then click Browse. .
A standard dialog box for opening files is displayed.
- Open demo.sav. See the topic Sample Files for more information.
- In the Copy Data Properties Wizard, click Next.
Figure 1. Copy Data Properties Wizard, Step 2 - If it's not already selected, click Apply properties from selected source dataset variables... and click (check) Create matching variables in the active dataset....
- In the Source Dataset Variables list, click (select) any variable, and then press Ctrl-a to select all of the variables in the file.
- Click Next.
Step 3 of the wizard allows you to select the variable properties you want to copy from the external data file.
Figure 2. Copy Data Properties Wizard, Step 3, variable properties For matching variables in the two files (variables with the same name and type), you can either Replace or Merge value labels. If the active dataset had any defined value labels, the Replace option would delete all of the existing value labels for matching variables and replace them with the labels from the matching variable in the external data file. In this example, however, there are no defined value labels; so, there's no difference between Replace and Merge.
- Click Finish to run the wizard and copy the variable properties from the external source file to the current data file.
- Make the Data Editor the active window and, if Variable View isn't already displayed, click the Variable View tab.
The first thing you may notice is that the data file now has more variables than the five it started out with. All of the selected variables in the external source file that didn't already exist were created in the current data file.
Matching variables--variables with the same name and type in both data files--now have all of the defined variable properties of the source variables in the external data file. For example, the variable marital now has a value label of Marital status and value labels associated with data values (for example, 0 = Unmarried).
The two variables in the current data file without matching variables in the external source data file -- house and pets -- remain unchanged.