Page 1 of 1

Dictionary merging

Posted: February 20th, 2012, 1:33 am
by Sol
Hi All,
I have two dictionaries with same ID field i.e they can be linked with this ID. Please guide me as how to merge the two dictionaries in to one dictionary file. How can I also merge the data files associated with these dictionaries?
Thanks

Re: Dictionary merging

Posted: February 20th, 2012, 4:39 pm
by Gregory Martin
If you're merging records from different dictionaries, you first must make sure that the ID field is in the same position in both dictionaries and that none of the record types in each dictionary are the same. If this is the case, then I would:

1) Create a new dictionary, NewDict.dcf, by creating a copy of A.dcf.

2) Copy all of the records from dictionary B.dcf and paste them into dictionary NewDict.dcf. You an do this quickly by selecting all of the records (from the dictionary level view), copying them to the clipboard, and then pasting them on the level view of NewDict.dcf.

Now you should have a dictionary that describes the records from dictionaries A.dcf and B.dcf. Next you want to merge the data files associated with the dictionaries. For this you use the Concatenate Data tool to create a new file with the records from both data files.

Finally you need to sort this new data file so that the records from the two files are in order by ID. For this you use the Sort Data tool, selecting as the sort type "Record Sort (ids and record type only)." Add all of the IDs to the sort query, and then add the record type as the last value to sort on. Run this program, and now you have a data file that NewDict.dcf can read.

Let me know if you have questions.

Re: Dictionary merging

Posted: February 21st, 2012, 1:19 am
by Sol
Thanks martine,

Your response is very helpful. The sort program responded with error since it considered the ids from the second data file were duplicates of the first data file. We have behavioral and biological data for one respondent but with separate dictionnaries with the same id, we were assuming merging the two data files for analysis will be easy.

Thanks again

Re: Dictionary merging

Posted: February 21st, 2012, 1:52 am
by Gregory Martin
Are you sure that you did a record sort? When you select the option I highlighted, CSPro will join the cases together before checking if there are duplicates in your file.

Re: Dictionary merging

Posted: June 29th, 2012, 5:24 pm
by Sol
Sorry Martin, I am late.

Thanks so much. It worked well

Re: Dictionary merging

Posted: October 22nd, 2014, 12:31 am
by Amandine
Dear all,

I've followed your example for the dictionaries and it works well ! But I've a problem with the sort data tool.

In fact, I would like to compare results from two different survey with exactly the same IDs. Do we need two compare survey to have the same number of case? And if yes, how can I delete the surplus case ?
When I run the sort data tool, I've an error message as follow : "Sort Completed. Structure errors in resulting file"...

Thanks for your help,

Amandine

Re: Dictionary merging

Posted: October 27th, 2014, 6:28 pm
by Gregory Martin
I sent you an email about this. Did it address your concerns?

Re: Dictionary merging

Posted: August 17th, 2015, 9:54 am
by munirmdee1
Hi, Gregory. I have the same issue over here, but a little bit different. I have three dictionaries, Household1,Household2 and Individual. In Household1 and Household2 the ID is the same which is only HouseholdNumber, but in Individual ID is made up with two variables which are HouseholdNumber and IndividualID. In Household1 there are section A to B, and in Individual there are section C to E, and in Household2 there are sections F to J. How can I merge all these three dictionaries together and their datafiles?

Re: Dictionary merging

Posted: August 17th, 2015, 2:52 pm
by josh
For the individual sections I would first convert those from single occurrence records to multiplying occurring records and make the household id be the only id-item. The individual-id would just become a regular variable on each of the individual records. Make sure to keep the start positions and lengths the same. Then you can merge the individual and household records together as Greg describes.

Re: Dictionary merging

Posted: March 31st, 2016, 4:20 am
by Dawazangpo
Hi martine and gregory,
I have same issue and I did what you have explained in above queries and I have sorted the input files i.e data files after concatenating and when I try to export the sorted file. it says no output generated.......file not created. What could be the problem now.