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
Can I test country level data and firm level data in one regressionHello everyone, I'm trying to find the effects of culture on the existence of teamwork. My dataset …
-dstdize- to calculate average age-adjusted death rate by raceGood Morning, I would like to calculate the average age-adjusted death rate by race (separately for…
two stage IV approchbootstrap "repeated time values within panel" 2 SRI I'm trying to run 2sri approach(control functio…
Generating a new variable that equals the Nth non-missing value in a rowHi All, I am essentially trying to compress a row of variables into just the non-missing entries. M…
working out expressions(sum and multiply) in stata with some missing observationsHi Nick Cox I want to add and multiply certain variables in stata in a new variable VaR. My expres…
Subscribe to:
Post Comments (Atom)
0 Response to Merging dataset with different number of subjects
Post a Comment