Example 3.11 Generating Every Combination of Observations between Data Sets Based on a Common Variable When an Index Is Available
Goal
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 Step | DATA step |
Featured Step Options and Statements | KEY= option in the SET statement Automatic variable _IORC_ and %SYRC autocall macro program |
Related Technique | PROC SQL, WHERE clause and subqueries |
A Closer Look | Checking for Errors ... |
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.