Merging data
We will be covering all of the different ways to combine datasets. While it is nice when every variable you need is conveniently stored in one table or dataset, it doesn’t always happen. A large database will have several different tables and sometimes you need to compare two variables from two different tables, or you have part of a table stored in one part of the database and another month or year of the same table stored in another part of the database. There are many different ways to merge data, depending not only on the software or programing language you are using but also on how you need the tables to come together.
Key variables
Before we can jump in and talk about merging tables, we need to understand the concept of key variables. A key variable is simply a variable that is in both tables being merged, which allows all of the rows to be matched up in a way that makes sense.
Figure 5.1 – Customer names and customer...