I am trying to merge table 1 with table 2; however, table 1 has a visit # field and lab date fields, while table 2 only has an event date field. I want the merged table to show all labs that have a specific value at a certain visit and also include any corresponding events that happen on that same day or close to that date. The problem is an event date might be different than a lab date. Currently my table looks like this:
VISNO LAB EVENT
00 aa, bb xxxxxxxx
01 aa, ab xxxxxxxx
Because I can't merge by a common variable other that patient ID, the EVENT field repeats whenever there is more than one lab record. What I really want the table to look like is this:
VISNO LAB EVENT
00 aa, bb xxxxxxxx
01 aa, ab
Is there anyway to keep the events from repeating whenever there are multiple lab records?
Thanks.