Methods of Combining SAS Data Sets |
Merging combines observations from two or more SAS data sets into a single observation in a new data set.
A one-to-one merge, shown in the following figure, combines observations based on their position in the data sets. You use the MERGE statement for one-to-one merging.
One-to-One Merging
A match-merge, shown in the following figure, combines observations based on the values of one or more common variables. If you are performing a match-merge, then use the MERGE statement along with a BY statement. (In this example, two data sets are match-merged by the value of the variable Year.)
Match-Merging Two SAS Data Sets
Copyright © 2012 by SAS Institute Inc., Cary, NC, USA. All rights reserved.