This example draws on the General Social Survey 2016 data. For this example, we created two data files from the GSS2016 data, and we will act as if they are two original files that we would like to merge.
Here is file 1:
File 1 has five rows and six variables. Note that id consists of sequential numbers 1 through 5, while the variables measure personal characteristics of the respondents.
Here is file 2:
File 2 has five rows and three variables. Note that id consists of sequential numbers 2 through 6, while the variables measure two forms of happiness.
The primary match key, id, has the same name in each file and the data codes have the same meaning. For example, an id value of 2 in each file refers to the same individual.
Several joins are possible. You could merge the files in such a way that the combined file has the following...