Example 3.11 Generating Every Combination of Observations between Data Sets Based on a Common Variable When an Index Is Available


Combine two data sets that have a common variable where the common variable has duplicate values in both data sets and at least one of the data sets is indexed by the common variable. Produce a data set that contains all possible combinations of the observations where the values from the common variable match. Use indexing features to match the two data sets.

Example Features

Featured StepDATA step
Featured Step Options and StatementsKEY= option in the SET statement Automatic variable _IORC_ and %SYRC autocall macro program
Related TechniquePROC SQL, WHERE clause and subqueries
A Closer LookChecking for Errors ...

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.