Table Lookup using Match Merging
Use match merging to match your lookup items with the table information. Keep only those observations (IN= data set option) that correspond to your lookup items.
In this example we have selected a sample of subject - identified by ID - and their dates of transaction - DOT. We wish to extract information about each subject on the given transaction date - such as, items purchased, purchase price, etc.
Data Sample; * This data set contains sampled subjects.;
Informat DOT mmddyy10.;
Input ID DOT @@;
Datalines;
1011 02/02/2000 1299 11/23/1999 1346 03/20/2000 1387 06/07/1999 1387 07/05/2000
;
Data SampInfo;
Merge Library.Popltn /* Info for all subjects & dates. */
/* Assumed sorted on ID and DOT. */
Sample (IN=SampSubj);
By ID DOT;
If SampSubj;