try this
data set1;
input Variable1 Variable2;
cards;
124.3 342.0
721.30 876.05
. 654.98
. 543.6
456.1 .
39 .
783.01 .
765.10 765.0
;
run;
data set1_1;
set set1;
id=_n_;
if variable1 ne . then var1=strip(put(variable1,8.2));
if variable2 ne . then var2=strip(put(variable2,8.2));
run;
data set2;
input Variable1 $ Variable2 $;
id=_n_;
cards;
1243 3420
72130 87605
V2540 65498
. 543.6
4561 V3461
39 .
78301 .
76510 7650
;
run;
proc sql;
create table set3 as
select s1.var1, s1.var2, s2.variable1, s2.variable2
from set1_1 as s1
left join set2 as s2
on s1.id=s2.id;
quit;
data want;
set set3;
if missing(var1) and ^missing(variable1) then var1=variable1;
if missing(var2) and ^missing(variable2) then var2=variable2;
run;
... View more