I have two data sets that come from different sources, but contain similar variables. One such similar variable is "Procedure" from data set A and "SurgicalProcedure" from data set B.
I have already merged these two data sets into one giant data set we'll call data set C.
Sometimes the observations in these two variables match, sometimes they are different, sometimes an observation is missing in one but present in the other.
What I would like to do is merge the two variables so that "Procedure" overwrites whatever is in "SurgicalProcedure", but if "Procedure" is missing an observation and "SurgicalProcedure" has that observation, then the "SurgicalProcedure" observation is kept in the final merged column.
Example:
Procedure SurgicalProcedure
1 total mastectomy
2 segmental mastectomy
. MRM
5 Seg. Mast with IOLM
7 .
10 total mast. w/ IOLM, SLNB
. Seg. Mast with IOLM, SLNB
3 OLM, SLNB
Desired Result:
Procedure
1
2
MRM
5
7
10
Seg. mast. w/ IOLM, SLNB
3
Can someone help me solve my problem in SAS? If not SAS, then R is okay, or even Excel, but prefer SAS.
Thanks!
coalescec()
function? – Tom