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
Exporting Stata histogram to ExcelHi, I would like to exporting a Stata histogram to Excel. Code: use http://www.stata-press.com/da…
The Vuong test for 2 non-nested simple linear regression modelsHello All, I try to compare market reactions based on earnings as compared to contract announcement…
Creating a categorical variable with several conditionsDear all, I am a STATA-beginner and am currently struggling with creating a categorical variable tha…
Run the same script over multiple .dta files via a loopI have large table of 59 million observations across over 400 variables. These have been split the t…
bayesmh for bayes: heckprobitDear STATA experts, Thank you for reading my post. I wish to program the command in STATA 16 bayes:…
Subscribe to:
Post Comments (Atom)
0 Response to Merging dataset with different number of subjects
Post a Comment