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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.