Example 3.4 Combining Observations by the Formatted Value of a Variable

Goal

Perform a fuzzy merge by merging observations from two data sets based on the formatted version of the matching variable rather than the stored value.

Example Features

Featured StepDATA step
Featured Step Options and StatementsBY statement with GROUPFORMAT option
Related TechniquePROC SQL, left join, ON clause with functions

Input Data Sets

Data set PRIZES contains a list of four prizes and the last day of the month in which they are awarded. Data set PARTICIPANTS contains a list of participants who will receive a prize dependent on a completion date.

                PRIZES

 Obs   completed  prize 1 01/31/2009 Restaurant Certificate 2 02/28/2009 Audio Player 3 03/31/2009 Theater Tickets ...

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.