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
Margins from a mixed model with a log-transformed outcomeI run a mixed model of a log-transformed outcome using ‘mixed’ (and the dfmethod(kroger) option with…
Extreme values in upper/lower bound bands not in original dataI want to create a graph with upper/lower bound bands - using this code (similar to that used here U…
optimizeHi All, I have a big dataset (2432rows with 6 variables) looks like below. I would like to minimize …
Issues with running stata code for cnormI have issues running the stata code for cnorm as shown below, is there any way to resolve this issu…
Nested logit with invariant regressorI am trying to use nested logit specification for estimating school choice of households. The first …
Subscribe to:
Post Comments (Atom)
0 Response to Why cant I reproduce results after sorting
Post a Comment