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


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.


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 O’Reilly online learning.

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