When they are merged, the data for these 2 variables is is lost.
I've tried this with and without the tostring and format with the same results.
This data set is expanding so I want to avoid having to check and manually input the missing data.
Thanks for any ideas.
Code:
Here is the data I want to preserve: use "PlacesLived_V3.dta" tab1 a_2_districtText1 a_2_VDC1 -> tabulation of a_2_districtText1 a_2_distric | tText1 | Freq. Percent Cum. ------------+----------------------------------- Bhairahawa | 1 50.00 50.00 Chitwan | 1 50.00 100.00 ------------+----------------------------------- Total | 2 100.00 -> tabulation of a_2_VDC1 a_2_VDC1 | Freq. Percent Cum. ------------+----------------------------------- Bhairahawa | 1 50.00 50.00 Tadhi | 1 50.00 100.00 ------------+----------------------------------- Total | 2 100.00 This is the master data set: use "ExploreV5", clear tostring a_2_districtText1 a_2_VDC1, replace force format a_2_districtText1 a_2_VDC1 %11s a_2_districtText1 was byte now str1 a_2_VDC1 was byte now str1 merge 1:1 id using PlacesLived_V3, force (note: variable a_2_districtText1 was str1, now str10 to accommodate using data's values) (note: variable a_2_VDC1 was str1, now str10 to accommodate using data's values) tab1 a_2_districtText1 a_2_VDC1 -> tabulation of a_2_districtText1 no observations -> tabulation of a_2_VDC1 no observations
0 Response to Loosing data on merge
Post a Comment