I want to merge two datasets based on one variable (neither dataset contains duplicates on this variable and there are no other identical variables in both sets) and I would expect _merge==3 to be 4,845 (I exported my data to excel and checked it there), both datasets are original datasets so the input data must be identical with each run;
the code is very simple and looks like the following:
use "$path\facility", clear
sort id
drop if id == id[_n-1]
save "$path\facility", replace
use "$path\facilitysponsor", clear
sort id
drop if id == id[_n-1]
merge 1:1 id using "$path\facility"
keep if _merge ==3
However, each time I run the do-file I get slightly different values but never the correct number of merged data. Anyone has an idea where is my mistake?
Thank you in advance!
Related Posts with Please help: Merge 1:1 delivers different results after each runthrough
Assumptions necessary for running xtabond2I want to accurately estimate a production function lnY=alpha*lnK+beta*lnL+idiosyncratic error+fixed…
Canay's (2011) Fixed-Effect Quantile Panel Data Approach in the presence of some endogenous independent variablesDear Forum members, Let me apologize in advance if my question has been dealt with somewhere which …
Elasticity from IV probitDear Altruist, 1. I could implement the following commands with success. (STATA-14.2) probit smk p…
How to adjust the scala in a combined graph?Hi everyone, I have a problem with a combined graph. I want to adjust yscale but I do not occur any…
Hypothesis formation for a difference in difference analysisDear all, My study is concerned with the causal effect of development aid on support for democracy …
Subscribe to:
Post Comments (Atom)
0 Response to Please help: Merge 1:1 delivers different results after each runthrough
Post a Comment