Hi,
I am using a Medicare dataset to identify patients who underwent a procedure. One patient could undergo the procedure on multiple different dates and/or multiple hospitals, which is why my dataset contains duplicate observations. I am trying to merge this file to another file by provider_id and year of the procedure. However, due to multiple observations, I cannot merge them without duplicating my total observation n using merge m:m (which isn't suggested). When I try m:1 or 1:m, i get an error message that is due to the multiple observations. Any suggestions? Example of my main dataset below. Sorry if i posted incorrectly.
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(id date_proc provider_id year_proc)
75 16450 318 2005
76 17505 319 2007
76 17566 336 2008
77 17469 342 2007
78 17856 341 2008
79 19284 341 2012
80 18388 330 2010
80 18557 334 2010
80 18387 330 2010
81 18478 334 2010
81 18476 342 2010
82 17996 318 2009
83 18035 342 2009
84 16586 933 2005
84 16639 318 2005
85 17156 336 2006
85 17157 336 2006
86 17969 318 2009
86 18043 318 2009
87 17169 334 2007
87 17192 334 2007
end
format %tdnn/dd/CCYY date_proc
Thanks
Related Posts with Issues merging with duplicate observations
Year and industry fixed effectsHi guys, In my regression model, I need to control for year and industry fixed effects. However, I'…
Using Constraints with Movestay commandI want to test Lr test for endogenous switching regression equation (I have used movestay of this), …
Count the number of different values (ignoring missing)Hello everyone, I want to count the number of different values ignoring missing by pid. Code: * E…
Absolute value of residualHello Experts A typical measure for firms’ use of earnings management in the finance literature is b…
My fixed effects regression changes if I omit an omitted variableHello all, I run a fixed effects regression in a linear probability model of self rated health and …
Subscribe to:
Post Comments (Atom)
0 Response to Issues merging with duplicate observations
Post a Comment