Match Merge using Proc SQL
Tuesday, June 3, 2008
Jared in SAS

Here is some code I ran across to do matching and merging using Proc SQL.  I think I snagged it from someone on the SAS Google Group.

data oldids;
  infile cards;
  input idfield2 matchfield;
cards;
1 100
2 200
;

data unmatched;
  infile cards;
  input idfield2 matchfield;
cards;
. 100
. 200
;

PROC SQL NOPRINT;
  UPDATE unmatched
  SET idfield2 = (SELECT idfield2
  FROM oldids
  WHERE unmatched.matchfield EQ oldids.matchfield);
QUIT; 

View this code on my code snippet repository. 

Article originally appeared on jaredprins (http://jaredprins.squarespace.com/).
See website for complete article licensing information.