[EpiData-list] Merging two rec files

epidata-list at lists.umanitoba.ca epidata-list at lists.umanitoba.ca
Wed Nov 12 13:03:22 CST 2014

You just merge them in EpiData Analysis

Say you have file a and file b. You want to merge by ID. File a has v1 
v2 v3 fields and file b s1 s2 and s3

* do this:
read a
merge id  /file=b
tab mergevar
savedata ab
browse id v1 v2 v3 s1 s2 s3 mergevar

You need only these lines to create a combined file for further analysis 
or documentation and for the first simple control of whether the 
combination went right.
If you have more than one variable for the merge just write them next to 

The mergevar variable will tell you from which file a given 
record/observation was found:
mergevar is defined with variable labels for these values:
1 : Only in memory (original) 2 : Only in external file 3:In both

It is good practice to be very careful and compare the data before and 
after a merge. In particular I always look at the first, the last and 
some record in the middle of the file. And I always compare content with 
original forms.

Jens Lauritsen
EpiData Association

On 12-11-2014 19:24, epidata-list at lists.umanitoba.ca wrote:
> Dear EpiData users and experts
> I am trying to merge
> ​ two files with different number of records and fields!
> ​The first file (intake) contain​​​s 1433 records and  there is  21 fields
> in each record. The second one contains ​1301 records and and each record
> contains 31 fields. Each one of the 1301 record has a  corresponding record
> in the first file (same code). I would like to merge the two files, based
> on the code, so that I have  a third file with 1301 records and 52 fields.
> I tried to use the merge function in EpiData Entry, but it didn't work (the
> product was a file with only 47 fields instead of 52 ). I must say that
> some fields in the two files have the same name-can this be a reason for
> not merging these fields?
> ​Your help will be highly appreciated​
> ​Best,​
> MK
> _______________________________________________
> EpiData-list mailing list
> EpiData-list at lists.umanitoba.ca
> http://lists.umanitoba.ca/mailman/listinfo/epidata-list

More information about the EpiData-list mailing list