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)
Multiple time-failure analysis, event-specific coeffcients?Dear all, I am using stcox along with a stratification variable to estimate the hazard functions fo…
svy: tabulate seems to misprint the extended missing value .zHello Statalist members, I am using Stata 17 (ver.10May2022). I found that svy: tabulate doesn't se…
Scaling fitted values obtained from first stage of IVHi everyone: I am running the following regression where I instrument my binary endogenous treatmen…
Reducing repeated responses to find actual sample size from a multiple imputed datasetHi there I am hoping someone can advise me on this complex dataset that is derived from a dual frame…
Meta analysis using stata 15How can I test/visualize subgroup difference. I use metan by(subgroup) but I can’t get the differenc…
Subscribe to:
Post Comments (Atom)
0 Response to same code, same data, different results (sort isn't working)
Post a Comment