Hello!
I'm currently working with a healthcare table (Table 1) and trying to merge it based on a unique ID number. This primary table contains individual lab results and symptoms. I need to attach diagnosis codes to this table based on the unique ID number. Unfortunately, all the codes were listed individual and not as individual fields within one record with the unique ID number (Table 2). Is there a way to merge these two tables so I end up with all diagnosis codes in one record with the lab results and symptoms (Table 3)? I don't necessarily need the description associated with each code, but that would also be helpful if they could connected some how without making the table extremely long. Some of the records can have up to 20 Dx codes. Examples below:
Table 1:
Unique ID Date/Time Lab Results Symptoms 111100002 12/12/2017 130 Positive 36.5 111200000 11/15/2016 2350 Negative 38.5 111222333 5/6/2016 1415 Positive 36.5
Table 2:
Unique ID Dx Code Description 111100002 I12.9 Hypertension 111100002 E11.33 Bronchospasm 111100002 J98.5 UTI 111200000 A41.4 Type 2 Diabetes 111222333 E94.2 Anemia 111222333 N13.3 Kidney Failure
Table 3:
Unique ID Date/Time Lab Results Symptoms Dx Code1 Dx Code2 Dx Code3 111100002 12/12/2017 130 Positive 36.5 I12.9 E11.33 J98.5 111200000 11/15/2016 2350 Negative 38.5 A41.4 111222333 5/6/2016 1415 Positive 36.5 E94.2 N13.3