I am posting this in the hope that someone will see what I am doing wrong.
Syntax used:
merge 1:1 cnsmrid2 using "O:\SHARED\PLANNING\Research\PCA data 2017\4-5-18 never came\wvr 11032017 2014up 1per id.dta"
This error message was returned:
variable CNSMR_ID is str10 in master but long in using data
You could specify merge's force option to ignore this string/numeric
mismatch. The using variable would then be treated as if it contained
"".
r(106);
But the variable I specified for merging was called cnsmrid2, not CNSMR_ID.
In preparing to do this merge, I created a new id variable in each dataset so that
both were the same type of data - string .
for the WAIV file, I wrote:
clonevar cnsmrid2 = CNSMR_ID (CNSMR_ID was long)
tostring cnsmrid2, replace
save,replace
for the awrc + allen file, I wrote:
clonevar cnsmrid2 = ALTID2 ALTID2 is already string
(One of the new id variables was str7 and the other, str10)
I can't think of a reason why Stata would use CNSMR_ID instead of the ID variable specified for the merge.
Thank you for any insights you have.
p.s. I checked each ID variable for missing data. The codebook command reported 0 missing values.
I am using Stata 15.
Comment