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)
MCHANGE after GSEMHello statalisters, I am trying to estimate the marginal effects after a gsem command but am unsure…
How to generate a variable with with fixed correlations to an existing variable which already has a uniform distributionHi, I have generate a variable which I have called X, it has a uniform distribution like this: gen x…
starting values in mixedlogitDear All, I am analyzing a DCE to estimate WTP values for environmental protection and I am trying d…
asdocI have run a regression by gender and the results are shown in the attched file. the code i used is …
building a categorial variable based on confidence intervallsDear all, I try to part a continous variable in categories using the 50% CI for age groups. Litert…
Subscribe to:
Post Comments (Atom)
0 Response to same code, same data, different results (sort isn't working)
Post a Comment