Merging Two Data Sets Where Identical Entries from the First Data Set correlate to Unique Values in the Second Data Set
1 view (last 30 days)
Show older comments
Hello all,
I have two data sets that I'm trying to merge that have the following conditions:
1) The data is located in two separate excel books.
2) Identical Entries in the 1st data set (a Date+Time column, some identical to each other, some not) correlate to Unique Entries in the 2nd data set (a column of unique Dates+Times)
3)There is a linking variable between the two (a phone number), which is present in both data sets.
4) The 2nd data set has data points that do NOT correlate to data points in the 1st data sets (ie. there are some phone numbers in the 2nd data set that are not in the 1st data set. All the phone numbers in the 1st set correlate to numbers in the 2nd set. I'm only interested in phone numbers present in BOTH data sets.
5) The 2nd data set can have more dates than the 1st data set for the same phone number. (ie. 2nd data set may have 5 dates, whereas the first data set may only have 2)
WHAT I NEED: (thank you for reading all of that) I need code that will take the data points from BOTH data sets and do ALL of the following:
1) Match them according to phone number.
2) Pair the dates+times of both data sets in a way that minimizes the time difference.
3) Match the dates+times of both data sets in a one-to-one fashion.
4) Output the data into a table containing all the information for each row (1st data set has 10 columns, all with different info, 2nd data set has 16 columns, all with different info), preferable in excel. I know how to use xlswrite to output the information, so I'm less concerned about this condition of the output.
I KNOW THIS IS A COMPLEX PROBLEM, BUT PLEASE KNOW THAT IT'LL MEAN THE WORLD TO ME IF YOU CAN HELP ME WITH ANY/ALL PARTS OF IT.
This is a terrific community of brilliant individuals, and I thank all of you for contributing to make Matlab one of the best programs out their!
Please help! Chris
1 Comment
Sean de Wolski
on 16 Jun 2011
Too long, got confused. Please provide a small sample set of data: inputs/operation (or reason for what you want)/ outputs.
We understand data sets much better than essays!
Answers (1)
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!