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
random intercept random slope in multilevel GSEMHi, i would like to ask about adding random slope into the mediation model using GSEM. My model look…
Help using date time variables in stataHi all, I'm having trouble converting string variables into date/time variables, and can only get "…
🐍 Python: write to text fileDear All, below is a Stata-Python interface question. I need to write to a file opened in Stata fr…
negative hyper-geometric distributionUnlike some other distributions (negative binomial), Stata does not seem to have a function for nega…
_= invalid name r(198)Hi, I'm just getting back into Stata after a long illness, so I could use some help. I'm trying to r…
Subscribe to:
Post Comments (Atom)
0 Response to Merging dataset with different number of subjects
Post a Comment