Using the UNION Set Operator


The set operator UNION does both of the following:
  • selects unique rows from both tables
  • overlays columns.
overlays columns
The following example demonstrates how UNION works when used alone and with the keywords ALL and CORR.

Using the UNION Operator Alone

To display all rows from the tables One and Two that are unique in the combined set of rows from both tables, use a PROC SQL set operation that includes the UNION operator:
proc sql;
   select *
      from one
   select *
      from two;
Tables One, Two, and Output
With the UNION operator, ...

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.