Example 2.4 Selecting Unique Rows When Concatenating Tables

Goal

Select the unique rows among two or more tables based on the value of a specific column.

Example Features

Featured StepPROC SQL
Featured Step Options and StatementsUNION set operator
Related TechniqueDATA step PROC SORT, NODUPKEY option

Input Tables

Tables MARCHRUNNERS, APRILRUNNERS, and MAYRUNNERS contain the names and running times for the runners in the month that is specified in the table name.

             MARCHRUNNERS

   Obs  runner         racetime 1 Sanchez, SO 35:49.4 2 Flores, RX 38:32.8 3 Martinez, KF 36:12.3 4 Hayes, MU 35:24.7 5 Carter, RT 39:38.1 6 Rogers, LX 40:22.1 7 Clark, SQ 40:05.8 8 Taylor, TP 38:30.2 9 Smith, JD 37:03.5 10 Green, TF 37:50.0 11 Brown, GL 35:59.2 12 Lee, AO 39:36.4 ...

Get Combining and Modifying SAS® Data Sets: Examples Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.