Joining Multiple Tables and Views
So far, this chapter has presented PROC SQL queries
that combine only two tables horizontally. However, there might be
situations in which you have to create complex queries to combine
more than two tables. Here is an example of a complex query that combines
four different tables.
Example: Complex Query That Combines Four Tables
Suppose you want to
list the names of supervisors for the crew on the flight to Copenhagen
on March 4, 2000. To solve this problem, you need to use the following
four tables.
Table
|
Relevant Columns
|
---|---|
Sasuser.Flightschedule
identifies the crew who flew to Copenhagen on March 4, 2000
|
EmpID, Date, Destination
|
Sasuser.Staffmaster identifies the names and states of residence ... |
Get SAS Certification Prep Guide, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.