Match-Merging: Details

Match-Merging Syntax

Match-merging combines observations from two or more data sets into a single observation in a new data set according to the values of a common variable.
When match-merging, use the MERGE statement rather than the SET statement to combine data sets.
Syntax, DATA step for match-merging:
DATA output-SAS-data-set;
MERGE SAS-data-set-1 SAS-data-set-2;
BY <DESCENDING> variable(s);
  • output-SAS-data-set names the data set to be created.
  • SAS-data-set-1 and SAS-data-set-2 specify the data sets to be read.
  • variable(s) in the BY statement specifies one or more variables whose values are used to match observations.
  • DESCENDING indicates that the input data sets are sorted in ...

Get SAS Certified Specialist Prep Guide now with O’Reilly online learning.

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