Example 2.5 Selecting Rows in Common When Concatenating Tables

Goal

Select the rows common to all tables based on the value of a specific column.

Example Features

Featured StepPROC SQL
Featured Step Options and StatementsINTERSECT set operator

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
    13  Jones, LW      37:38.3
    14  Smith, KB      38:10.3
 APRILRUNNERS ...

Get Combining and Modifying SAS® Data Sets: Examples Second 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.