Merging two data files

Merge qualifier

!MERGE c f [ !SKIP n !MATCH a b ]
may be specified on a line following the datafile line. The purpose is to combine data fields from the (primary) data file with data fields from a secondary file (f). The effect is to open the named file (skip n lines) and then insert the columns from the new file into field positions starting at position c. If !MATCH a b is specified, ASReml checks that the field a (0< a < c) has the same value as field b. If not, it is assumed that the merged file has some missing records and missing values are inserted into the data record and the line from the !MERGE file is kept for comparison with the next record. At this stage it is expected that the lines in the !MERGE file are in the same order as the corresponding lines occur in the primary data file, and that there are no extraneous lines in the !MERGE file. (It is proposed to extend this so the orders do not need to agree and that multiple lines in the primary file could be merged with the same line of the !MERGE file.) For example, assuming the field definitions define 10 fields,
   PRIMARY.DAT   !skip 1
    !MERGE 6 SECOND.DAT  !SKIP 1  !MATCH 1 6
would obtain the first five fields from PRIMARY.DAT and the next five from SECOND.DAT, checking that the first field in each file has the same value. Thus each input record is obtained by combining information from each file, before any transformations are performed.

Return to start