SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Merging SAS Data Sets
Excluding Unmatched Observations


By default, DATA step match-merging combines all observations in all input data sets. However, you may want to select only observations that match for two or more specific input data sets.


Data sets with matching observations highlighted

To exclude unmatched observations from your output data set, you can use the IN= data set option and the subsetting IF statement in your DATA step. In this case, you use
  • the IN= data set option to create and name a variable that indicates whether the data set contributed data to the current observation

  • the subsetting IF statement to check the IN= values and output only those observations that appear in the data sets for which IN= is specified.

back||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement