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...
running estimation1000 times with random assign treated groupsHi everyone, I applied a difference-in-difference approach to one of my research projects. Especial…
Can a marginal effect be -1.37?After running a xtlogit model with an interaction term between a score (continuous variable) and res…
Using a td() Function with a min() Function with Local MacroI am attempting to display the minimum value of a local macro in a tm() format: A. local VLM 720 72…
Running regression each country/year using GMM with xtabond2 Dear Statalist, I want to estimate using GMM predicted Y value for each year and each country in a…
Confidence Interval for Sensitivity and SpecificityI have the following data and would like to calculate the confidence interval for the sensitivity an…
Subscribe to:
Post Comments (Atom)
0 Response to Duplicates - keep first and sometimes second...
Post a Comment