Please show test data, in the form of a datastep. It is not possible to diagnose a problem with a data based programming language without seeing data. At a rough guess, I would just merge the two datasets together e.g.
data want;
set have1 have2;
by idvar;
combined_var=coalsecec(varfromhave1,varfromhave2);
run;
There are a lot of assumptions in there, both sorted by idvar, both has idvar, etc. Again, without seeing data I couldn't possibly guess what you have.
... View more