Imagine that we had a file with dads like we saw in the previous example, and we had a file with kids where a dad could have more than one kid. The next example considers a one to many merge where one observation in one file may have multiple matching records in another file. The output below shows that the match merge worked properly. Use MATCH FILES to merge the dads2.sav and faminc2.sav files based on famidīelow we show the commands for performing the merge.Use SORT CASES to sort faminc on famid and save that file (we will call it faminc2.sav).Use SORT CASES to sort dads on famid and save that file (we will call it dads2.sav).(Note that this is a one to one merge because there is a one to one correspondence between the dads and faminc records.) These three steps are illustrated below. There are three steps to match merge dads.sav with faminc.sav.
![spss code combining data into variable spss code combining data into variable](https://theanalysisfactor.com/images/SPSS_Old_New_Values_Window.jpg)
The output of these statements is shown below, confirming that we have read the data properly. Below we create the files dads.sav and faminc.sav. Let’s start by creating the files that we will be merging. We would like to match merge the files together so we have the dads observation on the same line with the faminc observation based on the key variable famid.Īfter match merging the dads and faminc, the data would look like this. For example, below we have a file containing dads and we have a file containing faminc. When you have two data files, you can combine them by merging them side by side, matching up observations based on an identifier.
![spss code combining data into variable spss code combining data into variable](https://i.ytimg.com/vi/yHEnXtdVd2k/maxresdefault.jpg)
V1 and v2 are the two original variables in the dataset that will be merged to create the new variable (v) q is a newly created variable which indexes which variable each value in the newly created.
![spss code combining data into variable spss code combining data into variable](https://www.spss-tutorials.com/img/spss-recoding-variables.png)
For example, you may have measured people’s BMI (body mass index) as a continuous variable but may want to use it to create groups. 1 Introduction Recoding may be needed in a number of different situtions.