Hello
I am working with a large dataset in Stata with 40,000 stroke patients admitted to a hospital, and I could really use some help regarding duplicates.
Some patients in my dataset have been admitted several times during the study period, and I want to keep only first visits, but it appears, that some patients were registered twice during the hospital stay with the same stroke - i.e. they were actually registered twice during the first visit (due to transfer between hospitals). In that case I want to keep both first and second entry of this patient, because it is in fact the same stroke, that is being treated.
For each observation I have a:
Personal identification number “pnr”
I have generated a variable “visit_n” (1 for first, 2 for second, 3 for third visit and so on).
I have the admission date “acutedate” (days after 1st Jan 1960).
I want to keep visit 1 for all patients and delete all visits with a value >1, except if visit 2 is within the first 2 days after visit 1.
I hope this is understandable, and that you can help me, thanks in advance!
Kind regards
Sine Mette Buus
Related Posts with Duplicates - keep first and sometimes second...
DF in clustered regression linear coefficient testI am not sure I understand why the degrees of freedom are 36 rather than 390 in the following Wald t…
Code to run Spatial Logit/Probit Model in StataHi Statalist member, I am trying to identify the factors that are affecting the households decision…
Comparing proportions by two different variablesHello there, I want to make compare two proportions of a categorical variable by two different expl…
margins after svyI am looking at the differences in wages for specific occupations by marital status. Note marital st…
Computational time of lasso2 vs. rlassoHello, I am using the lasso2 package for model building and variable selection and have some questi…
Subscribe to:
Post Comments (Atom)
0 Response to Duplicates - keep first and sometimes second...
Post a Comment