I have been trying to merge a file with a tempfile. evertime stata shows "variable HHID does not uniquely identify observations in the using data" or "invalid specification". Can you tell where I did mistake in writing command?


global female_baseline "C:\Users\sehri001\OneDrive - WageningenUR\Farzana_PhD\PhD_Academic\PhD work\PhD research\ANGeL\ANGel_Data\Raw_data_Angel\Baseline_ RawData\STATA\household_female"

cd "$female_baseline"

use hh_mod_a_002.dta, clear
sort HHID
keep HHID HHTYPE A12 A13

recast double HHID
//the type of variable of HHID was int in this dataset. However, the type fo variable of HHID was double in the temfiles. So I have toc hange the type to merge datafiles.

merge 1:1 HHID using `dil_answer_2015'