Previous Page | Next Page

Methods of Combining SAS Data Sets

Definition of Merging

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

[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

[Match-Merging Two SAS Data Sets]

Previous Page | Next Page | Top of Page