Dear Statalists,
Thank you for seeing the post!
I'm curious whether we can stsplit on different dates in an imputed dataset.
I have a dataset of about 98000 non-smokers, 7000 smokers who answered the second questionnaire, and 5000 smokers did not provide detailed age when started smoking.
I first imputed the age when started smoking (age_start), then I calculated the date first started smoking (date_start) . Now I want to stsplit the dataset before Cox regression.
However, it seems that in each imputation (from 1/10), the obs created are different thus not allowed for the MI structure.
In the MI strucre, within each imputation, _mi_id is the unique id for each line. After mi stsplit, the _mi_id will be updataed automatically to remain unique. I tried to manully update the _mi_id after each stsplit, but it didn't work.
Below are the codes I used. Thanks!
And the error :
Thank you for seeing the post!
I'm curious whether we can stsplit on different dates in an imputed dataset.
I have a dataset of about 98000 non-smokers, 7000 smokers who answered the second questionnaire, and 5000 smokers did not provide detailed age when started smoking.
I first imputed the age when started smoking (age_start), then I calculated the date first started smoking (date_start) . Now I want to stsplit the dataset before Cox regression.
However, it seems that in each imputation (from 1/10), the obs created are different thus not allowed for the MI structure.
In the MI strucre, within each imputation, _mi_id is the unique id for each line. After mi stsplit, the _mi_id will be updataed automatically to remain unique. I tried to manully update the _mi_id after each stsplit, but it didn't work.
Below are the codes I used. Thanks!
Code:
mi impute chained /// (ologit) education income /// (mlogit, augment) job /// (regress) age_start /// = i.sex i.cov1 i.cov2, add(10) rseed(123) mi passive: gen date_start = dob + (age_start*365.25) if smoke==1 mi stset date_exit, failure(fail) origin(dob) enter(date_bl) scale(365.25) id(pid) mi stsplit split, after(date_start) at(0)
Code:
performing stsplit on m=0; 4002 obs created performing stsplit on m=1; 7408 obs created results could not be duplicated performing stsplit on m=0 resulted in 115147 obs. perfroming the same operation on m=1 resulted in 118553 obs. Results should have been the same.
Comment