I am dropping observations based on the if statement (drop if entryyear~=entryyear_surv) written in a do file. I have all the code in the do file highlighted and run it. I've run the code several times, and I got same results for the 1st stage but from 2nd stage different results are obtained. No code has changed between each time I run it, and 'sort' and 'sort,table' doesn't work. Below is the part of my do file. Thanks for your help in advance.
use admin_18, clear
merge m:m birthdate sex country immvisa_raw using 2018f_1
keep if _merge == 3
/*1st stage*/
sort birthdate sex country immvisa_raw, stable
egen matchid = group(birthdate sex country immvisa_raw)
drop if matchid == .
duplicates tag matchid, g(dup)
/*2nd stage*/
by pid, sort: drop if (entryyear~=entryyear_surv) & dup>0
Related Posts with same code, same data, different results (sort isn't working)
Return do.filesHi. I have accidentally closed do.file without saving the changes. Is there anyway to return unsaved…
Difference-in-Difference-in-Difference with Continuous Treatment VariableI am trying to estimate the effect of 4H participation on student test scores in Virginia using the …
How to compute the probability for a firm to move from on group to another in a panel database?I have a panel database for firms i (90 firms) across year t (from 2013 to 2019). Some firms witness…
ivreg/ ivprobitThe impact of child health on the school enrollment so child's health is endogenous and the author …
Which analysis pre/post analysisDear experts, For my thesis I have to do an analysis in Stata but unfortunately do I have problems …
Subscribe to:
Post Comments (Atom)
0 Response to same code, same data, different results (sort isn't working)
Post a Comment