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 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.