data have1;
input a b ;
datalines;
1 1
1 2
1 3
1 5
1 7
2 1
2 2
2 3
2 5
2 7
;
data have2;
input c;
datalines;
2
4
;
proc sql;
create table wanted as
select a,b,c
from (select distinct a from have1),have2
full join
(select distinct b from have1)
on b=c or b=.
order by a, coalesce(b,c);
quit;