|
How to Collapse Multiple Records into a Single Record
By Bryan K. Beverly,
BAE Systems Information Technology
PROBLEM: In data processing, it is often necessary to reconcile records from several time points into a single record that contains the data from all time points.
SOLUTION: One way of collapsing multiple records into a single record is demonstrated below. Using an input file consisting of multiple records per ID (data set BEFORE_DB), the code:
1) sorts the file by ID
2) splits the sorted file into master and transaction files
3) uses the UPDATE statement to merge the transaction records into the master records
CAVEAT: This approach may have to be tweaked based upon the number of sort keys or if there are special requirements for handling missing values.
|
|