Understanding Joins

You combine data horizontally by merging or joining multiple data sets into one data set. This process is called horizontal combination because, in the final data set, each observation (or horizontal row) has variables from more than one input data set.
Figure 3.1 PROC SQL: Understanding Joins
PROC SQL: Understanding Joins
A PROC SQL join is a query that specifies multiple tables or views to be combined based on the conditions under which rows match and return a result set.
Joins combine tables horizontally, side by side, by combining rows. The tables being joined are not required to have the same number of rows or columns.
Note: You can use a join to combine views as well as tables. Most of the following references to tables are also applicable to views; any exceptions are noted.
When you use a PROC SQL query to join tables, you must decide how you want the rows from the various tables to be combined. There are two main types of joins, as shown below.
Type of Join
Output
Inner join
Venn Diagram, Inner Join
only the rows that match across all table or tables
Outer join
Venn Diagrams, Outer Join
rows that match across tables (as in the inner join) plus nonmatching rows from one or more tables
When any type of join is processed, PROC SQL starts by generating a Cartesian product, which contains all possible combinations of rows from all tables.
Last updated: October 16, 2019
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.105.193