Hello, this is my first post and I am a bit of a newbie so I hope my question is not too obvious.
I am working on a database of patients that underwent a procedure where contrast was administrated. This database has 1722 observations of a certain procedure but the contrast is not recorded in this database it is recorded on another database that has all of the procedures performed and has over 15,000 observations.
I tried to perform a many to many merge and to keep only the observations from the master database, but I end up either losing patients or adding patients to the original. I am merging according to a clinical history number which is unique to each patient and to the date of the procedure. I suspect that this is because some patients have 2 procedures on the same day and that stata is duplicating these patients.
I don’t know how to identify the patients that were duplicated because they had 2 procedures performed the same day or how to identify the patients that no data was added because the contrast volume was not recorded.
I am adding the syntaxis used and the variables that were created
use "C:\Users\marce\Desktop\Tesis\Resultado\Intrah ospi talario\Datos basales.dta"
merge m:m NHC FechaCate using "C:\Users\marce\Desktop\Tesis\Resultado\Intrah ospi talario\contraste.dta", keepusing(Contraste)
Result # of obs.
-----------------------------------------
not matched 12,639
from master 628 (_merge==1)
from using 12,011 (_merge==2)
matched 1,690 (_merge==3)
drop if _merge ==2
I end up with 2318 observations and at the beginning, I only had 1722.
Thank you in advance, I tried to explain as thoroughly as I could.
Related Posts with Merging dataset with different number of subjects
how to save a vce output of biprobit model in excel and RHi everyone, I ran a biprobit model and used a post-estimation command of "estat vce" and "estat vce…
Moderated mediation/conditional indirect effects after multiple imputation in Stata15Hi all, I need to run a moderated mediation analysis in Stata to estimate a conditional indirect ef…
Regression discontinuity in time and logit approachHi all, I have got a question concerning a regression discontinuity design with time series data. …
Changing the base year, and creating an index from that year in a time seriesHello, I have a similar problem as last time. But slightly different and have been trying for a few…
Sensitivity analysis after propensity matching (sensatt user written command)Dear Statalist members, I'm using the user written command "sensatt" (https://www.stata-journal.com…
Subscribe to:
Post Comments (Atom)
0 Response to Merging dataset with different number of subjects
Post a Comment