So you want to take the value of VARIABLE2 and use it to find the row where VARIABLE has the same value? So to do that with a MERGE statement you will want to merge by the value of VARIABLE2.
So first sort the data by VARIABLE2.
proc sort data=example2;
by Variable2;
run;
Then make a version that just has the first two columns, but rename them so the variable name column matches but the value columns name doesn't conflict.
proc sort data=example2 (keep=Value Variable rename=(Value=New Variable=Variable2))
out=example2b
;
by variable2;
run;
Now you can just merge the two tables. But you only want to keep the original set of rows so use the IN= dataset option.
data want ;
merge example2(in=in1) example2b;
by variable2;
if in1;
run;
If you want a more efficient method you could look into using a data step HASH object. You could load the variable/Value pairs into a hash and then use the FIND() method to check for the value associated with Variable2. If found then copy the value into a new variable. Note that you will need then re-find the value associated with VARIABLE since the previous FIND() will have overwritten VALUE.
data want ;
set example2;
if _n_=1 then do;
declare hash h(dataset: 'example2');
h.definekey('Variable');
h.definedata('Value');
h.definedone();
end;
if not h.find(key: Variable2) then new=value;
h.find();
run;