Example 3.2 Merging Observations from Multiple Data Sets by a Common Variable

Goal

Combine observations from multiple data sets based on a variable common to each contributing data set.

Example Features

Featured StepDATA step
Featured Step Options and StatementsMatch-merge with MERGE and BY statement
Related TechniquePROC SQL, multiway join with WHERE clause
A Closer LookUnderstanding How the DATA Step Processes a Match-Merge

Input Data Sets

Data set AGENTS contains the names and IDs of five real estate agents. Data set PROPERTIES contains a list of properties that have sold. The agent responsible for the sale is identified by the ID variable. Data set RATES contains the commission rates for the five agents with the agent identified by the ID ...

Get Combining and Modifying SAS® Data Sets: Examples Second Edition now with O’Reilly online learning.

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