One easy solution is to record the original order in a separate variable before sorting and merging. Then, you can resort on this separate variable back to the original order.
data a;
set a;
order +1;
run;
proc sort data=a; by var1; run;
proc sort data=b; by var1; run;
data combined;
merge a b;
by var1;
run;
proc sort data=combined; by order; run;