Overview If you read Query data, you saw ways to query a single table using PROC SQL. However, you often need data from separate tables. When you specify multiple tables, views, or query-expressions in the FROM clause, PROC SQL processes them to form one table. The resulting table contains data from each contributing table. These queries are referred to as joins. Conceptually, when you specify two tables, PROC SQL matches each row of table A with all the rows of table B to produce an internal or intermediate table known as the Cartesian product. The Cartesian product of large tables can be huge, so typically you want to subset data by declaring the join type. There are two types of joins:
|
||||||
This task focuses on joining tables. For details on querying single tables, see Query data. |
Point-and-Click Method You can join tables using a point-and-click interface.
You can view and save the PROC SQL code that the SQL Query window generates. |