data one;
input name $ Var1 $;
datalines;
Alex a
Alex b
Mary c
Mary d
; run;
proc sort data=one;
by name;
run;
data two three;
set one;
if first.name then output two;
if last.name then output three;
by name;
run;
data four;
merge two three (rename=(var1=var2));
run;
proc print data=four; run;