My master dataset has one variable county which I'm generating ( using - gen county1 = county- command. Changed the number in master data so that you can merge with using. But, that's the command I used ) in a different name as county1 to match with my using data. My master data looks like the following with county and the same variable in a different name county1
My using data has three columns. Column 1 is a fixed amount of counties ( 100 ) out of all the census counties. Column 2 is the minimum distance of each county from any of those fixed numbers of counties in column 1. Column 3 is all the census counties available. Therefore, using data is identified uniquely based on county1(from column1 of using data ) and county ( column 3 of using data). Therefore, I regenerated the county1 variable in my master data to match with using data uniquely.
My using data looks like following
After merging I'm getting the following result. Is this happening because of long and float format of county and county1? I tried changing both of them to float using recast but eventually one of them automatically changes to long format.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long county float county1 10001 24003 10003 42101 20045 20045 20045 20045 11001 51107 21045 21045 20047 20047 20047 20045 12009 12095 12019 12031 end
My using data looks like following
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float county1 double mi_to_county long county 24003 57.19865840354873 10001 42101 40.40149007443556 10003 24003 25.296911561215097 11001 51107 35.55806556932951 11001 12031 39.019664192183974 12003 12031 40.99176960439295 12007 12095 40.69641745688267 12009 12086 40.307247788423894 12011 12071 22.085989388972475 12015 12031 27.12930958102275 12019 13063 32.12455074883614 13217 13063 59.35042862727376 13219 13063 36.45950620886324 13223 end
Code:
Result Number of obs ----------------------------------------- Not matched 25,098,392 from master 25,098,392 from using 0 Matched 0 -----------------------------------------
Comment