I am trying to match observations based on their text description, from two datasets, using reclink. I have a main dataset, which I have split into a master and using dataset, to be compatible with reclink. This main dataset was formed by merging on a common string ID, and I am using reclink to see if observations merged with the same ID indeed have the same or similar text descriptions (sometimes the same ID can refer to a different observation across the two datasets). I am getting a "type mismatch error, r(109)" when I perform reclink (below).
I am getting this error:
"type mismatch
post: above message corresponds to expression 1, variable classno_1927
r(109); "
Here are dataex examples of each of the datasets (main, master, using):
Main:
Master:
Using:
I thought the error was because the common ID between the two datasets (classno_1927, classno_1928) was string, but that doesn't seem to be the case.
Code:
* Load the "main" dataset import excel using merge_1927_1928.xlsx, sheet("Matched(3)") firstrow allstring clear preserve keep classno concat_new_1927 // forming the master dataset rename (concat_new_1927 classno) (concat_new classno_1927) // renaming variables to be compatible with reclink syntax tempfile matched_set_1927 display "`matched_set_1927'" save `matched_set_1927' restore keep classno concat_new_1928 // forming the using dataset rename (concat_new_1928 classno) (concat_new classno_1928) // renaming variables to be compatible with reclink syntax tempfile matched_set_1928 display "`matched_set_1928'" save `matched_set_1928' * Load the master dataset (ie 1927) use `matched_set_1927', clear * Perform record linkage with the using dataset (ie 1928) reclink concat_new using `matched_set_1928', idmaster(classno_1927) idusing(classno_1928) gen(score)
"type mismatch
post: above message corresponds to expression 1, variable classno_1927
r(109); "
Here are dataex examples of each of the datasets (main, master, using):
Main:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str8 classno str514 concat_new_1927 str390 concat_new_1928 "01497" "othermeatfrogslegs" "frogs'legs" "01499" "othermeatmeatsfreshnspf" "meatsfreshnspf" end
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str8 classno_1927 str514 concat_new "01497" "othermeatfrogslegs" "01499" "othermeatmeatsfreshnspf" end
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str8 classno_1928 str390 concat_new "01497" "frogs'legs" "01499" "meatsfreshnspf" end
I thought the error was because the common ID between the two datasets (classno_1927, classno_1928) was string, but that doesn't seem to be the case.