Excluding Unmatched Observations

Overview

By default, DATA step match-merging combines all observations in all input data sets.
To exclude unmatched observations from your output data set, use the following in your DATA step:
  • Use the IN= data set option to create and name a variable that indicates whether the data set contributed data to the current observation.
  • Use the subsetting IF statement to check the IN= values and write to the merged data set only matching observations

Identifying Observation in Both Data Sets

To match-merge the data sets Clinic.Demog and Clinic.Visit and select only observations that appear in both data sets, use IN= to create two temporary variables, Indemog and Invisit. The IN= variable is ...

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.