Example 3.6 Combining Rows When There Is No Common Column

Goal

Combine rows from two tables based on specific criteria, even when there is no column common to the two tables.

Example Features

Featured StepPROC SQL
Featured Step Options and StatementsFull join, WHERE clause with BETWEEN operator
Related TechniqueDATA step, multiple SET statements, POINT= and NOBS= options

Input Tables

Tables BUILD_PROJECTS and BUILD_BILLS have no common column. The dates associated with each project in BUILD_PROJECTS do not overlap with any other project.

          BUILD_PROJECTS

Obs  start_date    end_date  project 1 01/08/2010 01/27/2010 Basement 2 02/01/2010 02/12/2010 Frame 3 02/15/2010 02/20/2010 Roofing 4 02/22/2010 02/27/2010 Plumb 5 03/02/2010 03/05/2010 Wire 6 03/08/2010 ...

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.