Hello,
I'm a STATA novice and am having trouble in the final stage of compiling a data set merging year*place_code crime data (3700 records) and year*place_code population data (4128 records):
But when I run the above code, I get this error message:
And I know that there are many visual matches on various year*place_code combinations.
What am I misunderstanding?
Are the on-the-fly variable type changes (e.g., "variable county_fips was int, now float to accommodate using data's values") maybe somehow related?
Thanks for any help!
- thomas
I'm a STATA novice and am having trouble in the final stage of compiling a data set merging year*place_code crime data (3700 records) and year*place_code population data (4128 records):
clearI expected/hoped to get <=3700 year*place crime records matched to the corresponding year*place population records, discarding records from either source that could not be matched.
use "...placecountyyr_crimclr.dta" /*3700 recs*/
merge 1:1 year place_code using "...placecountyyr_pop.dta" /*4128 recs*/
But when I run the above code, I get this error message:
(note: variable county_fips was int, now float to accommodate using data's values)Yet when I run the following commands:
(note: variable place_code was long, now double to accommodate using data's values)
variables year place_code do not uniquely identify observations in the using data
r(459)
use "...placecountyyr_crimclr.dta"...I get the same message both times:
duplicates list year place_code
use "...placecountyyr_pop.dta"
duplicates list year place_code
Duplicates in terms of year place_codeThat is, as I expected/designed, there is only 1 record for a given place and year, both in the crime and in the population data sets.
(0 observations are duplicates)
And I know that there are many visual matches on various year*place_code combinations.
What am I misunderstanding?
Are the on-the-fly variable type changes (e.g., "variable county_fips was int, now float to accommodate using data's values") maybe somehow related?
Thanks for any help!
- thomas
Comment