Good evening all. I am looking for some help merging 3 data sets.
All 3 data sets are sorted by patient ID (ptid) and I would like to merge by ptid. The issue is that the master data set has one row per ptid, but the other two have multiple rows of data with the same ptid.
I was able to merge the master data set with one of the 2 other data sets no problem using 1:m merge.
code:
use "apap_analysis"
merge 1:m ptid using "apap_meds"
Now I am unsure of how to merge in the 3rd data set, which contains the same ptid variable, but otherwise contains different variables than the first two datasets.
I tried using the m:m merge, but it created issues in the data, mainly duplicating rows of variables that I do not want to be duplicated.
Does anyone know how I can merge in the 3rd data set? Can I tag the ptid in all 3 data sets and merge based on the tag ptid?
I can provide more detail/clarification if needed.
Thanks!!
Related Posts with Merging 3 data sets
Fractional Heteroskedastic probitI have a fractional dependent variable and I am using a fractional heteroskedastic probit model. How…
Independent variable is omitted due to collinearity when using xtabond2 commandI ran the xtabond2 command using Stata 11 and got all the results needed for different models. I sav…
Assessment of my model?Hello, I examine the Determinants of Banking Profitability. I have 3 Dependent variables that will b…
interaction term with quadratic term?1) Y= X1+ X1*X1+X2 + X1*X2 + (X2)*(X1*X1) i.e. adding not only the interaction with the low level X1…
Generating new values for an existing variable which is the sum of the current values within that variableDear all, I am currently wondering how to achieve the following. I have a country sector year datas…
Subscribe to:
Post Comments (Atom)
0 Response to Merging 3 data sets
Post a Comment