Dear Statlisters,
Why can't I reproduce the results after this lines of code. I am working with longitudinal data in long format. uuid is the unique identifier
bysort uuid -dispensing_date : egen max_duration = max(duration)
gen startdate = dispensing_date
sort uuid -dispensing_date
by uuid: gen stopdate = dispensing_date[_n+1]
noisily: sum duration
replace stopdate = date("1/7/2020", "DMY", 2009) if stopdate == .
gen time = stopdate - startdate
drop if duration != max_duration
noisily: sum duration
drop if time == 0
noisily: sum duration // this line does not produce consistent results.
Regards
Related Posts with Why cant I reproduce results after sorting
Confusion with loopingDear Statalist, I’m having problems with looping through variables. I am using Stata 15.1 for Windo…
Albatross Plot - By() more than one variableI am creating an albatross plot (basically a scatter of p-values vs sample size) of compiled literat…
Deciding on difference in difference specificationDear All, I have micro data at firm level. I am looking to the impact of migration on firm-level pr…
Calculating sigma convergence using nl model in stataHey, I am currently trying to evaluate sigma convergence on NUTS 3 level within the EU and was unsu…
Difference in concentration indexHi I was wondering if any one can help as fairly new to this. I am trying to establish if there is a…
Subscribe to:
Post Comments (Atom)
0 Response to Why cant I reproduce results after sorting
Post a Comment