Example 2.6 Selecting Observations Unique to Each Data Set When Concatenating Data Sets

Goal

Select observations found in only one data set among a group of data sets based on the value of a specific variable. Concatenate the selected observations.

Example Features

Featured StepPROC SORT DATA step
Featured Step Options and StatementsMERGE statement with IN= option (match-merge)
Related TechniquePROC SQL, OUTER UNION set operator, GROUP BY and HAVING clauses

Input Data Sets

Data sets MARCHRUNNERS, APRILRUNNERS, and MAYRUNNERS contain the names and running times for the runners in the month that is specified in the data set 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 ...

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.