Using the INTERSECT Set Operator

A Brief Overview

The set operator INTERSECT does both of the following:
  • selects unique rows that are common to both tables
  • overlays columns
Figure 4.3 INTERSECT Set Operator Relationship
INTERSECT Set Operator Relationship

Example: Using the INTERSECT Operator Alone

The INTERSECT operator compares and overlays columns in the same way as the EXCEPT operator, by column position instead of column name. However, INTERSECT selects rows differently and displays in output the unique rows that are common to both tables.
The following PROC SQL set operation uses the INTERSECT operator to combine the tables Col1 and Col2.
proc sql; ...

Get SAS Certified Professional Prep Guide 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.