Example 3.10 Generating Every Combination of Rows between Tables Based on a Common Column

Goal

Combine two tables that have a common column where the common column has duplicate values in both tables. Produce a table that contains all possible combinations of the rows where the values from the common column match.

Example Features

Featured StepPROC SQL
Featured Step Options and StatementsFull join with WHERE clause
Related TechniqueHash iterator object in the DATA step

Input Tables

Table MEETINGS contains events to be held on two days and the expected attendance for each event. Table MEETINGROOMS contains meeting rooms that are available for the same two days. The column in common between the two tables is MEETINGDATE with multiple occurrences ...

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.