I was trying to merge two datasets (code:joinby), however it seems that stata cannot identify my key variable.
The master dataset looks as follows:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float id str12 inventor_id int nodes float(_degree dg_central) 2 "4677061_3" 455 .05947137 .04970777 3 "4891185_1" 16 .6 .2857143 4 "5281603_1" 662 .031770047 .02461376 4 "3956484_2" 662 .031770047 .02461376 5 "5321008_2" 11 .4 .24444444 end
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str12 inventor_id float(id kd_4) "4013665-2" 1934 .2738613 "4381297-1" 1934 .3535534 "4464380-1" 1934 .3535534 "4571404-1" 1934 .4950738 "4985433-4" 1934 0 end
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str12 inventor_id float(id kd_4) byte _merge int nodes float(_degree dg_central) "4677061_3" 2 . 2 455 .05947137 .04970777 "4891185_1" 3 . 2 16 .6 .2857143 "3956484_2" 4 . 2 662 .031770047 .02461376 "5281603_1" 4 . 2 662 .031770047 .02461376 "5124314_1" 5 . 2 11 .4 .24444444 end label values _merge __MERGE label def __MERGE 2 "only in using data", modify
The code is:
Code:
joinby id inventor_id using " `temp1' ", unm(m)
Code:
replace inventor_id = trim(itrim(inventor_id))
Code:
destring inventor_id, replace tostring inventor_id
Any ideas will be highly appreciated.
0 Response to Problems with merge
Post a Comment