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.
0 Response to Merging dataset with different number of subjects
Post a Comment