Dear All,
I hope you are doing well. I have some additional district characteristics (e.g. No_Shrines_all_distr) in a using dataset which I want to add to the master dataset.
My master dataset is as follows (where bench is my district identifier that is common in both datasets) :
My using dataset is as follows:
Now I want my No_Shrines_all_distr total_pop_distr to be filled with information from using dataset i.e. for my "using" dataset I know that the district "khyhc" has No_Shrines_all_distr to be 0, so I would want 0 in front the No_Shrines_all_distr every time an observation for khyhc appears in my master dataset, so far it is missing.
Doing a many to 1 merge only helps me merge the new gov_archives variable but not the variables that exists in both data sets i.e. No_Shrines_all_distr long total_pop_distr
I also tried joinby but sort of got the same problem. Probably, I am not applying it correctly.
Any help here to resolve this merging problem will be really appreciated.
Cheers,
Roger
I hope you are doing well. I have some additional district characteristics (e.g. No_Shrines_all_distr) in a using dataset which I want to add to the master dataset.
My master dataset is as follows (where bench is my district identifier that is common in both datasets) :
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str6 bench float(No_Shrines_all_distr total_pop_distr) byte StateWins float caselag " banhc" . . 1 6 " banhc" . . 1 6 " banhc" . . 0 7 " banhc" . . 0 3 " khyhc" . . 1 5 " khyhc" . . 1 4 " khyhc" . . 1 2 end
My using dataset is as follows:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str5 bench byte No_Shrines_all_distr long total_pop_distr byte gov_archives "abohc" 0 880666 1 "dikhc" 1 38990 1 "kashc" 4 19593 1 "phc" 1 53841 1 "quehc" 0 84000 1 "islhc" 0 77000 1 "khyhc" 0 546730 1 "sibhc" 1 180398 1 end
Doing a many to 1 merge only helps me merge the new gov_archives variable but not the variables that exists in both data sets i.e. No_Shrines_all_distr long total_pop_distr
Code:
merge m:1 bench using ".\Gov_Shrines.dta"
Any help here to resolve this merging problem will be really appreciated.
Cheers,
Roger
Comment