It looks like you could use the MERGE statement. What code have to tried? Did you get an error, or wrong result?
The Boston Area SAS Users Group (BASUG) is hosting our
in person SAS Blowout on Oct 18!
This full-day event in Cambridge, Mass features four presenters from SAS, presenting on a range of SAS 9 programming topics. Pre-registration by Oct 15 is required.
Full details and registration info at
https://www.basug.org/events.