I want to union the same table this way
ID B C D E
1 11 12 13 14
2 21 22 23 24
3 31 32 33 34
to
ID B C D E
1 11 12 13 14
2 21 22 23 24
3 31 32 33 34
11 13 14
12
21 23 24
22
31 33 34
32
based on the IDs of a third table. (I want to have only those IDs which are present in a third table)
third table
ID
1
3
21
31
I am able to do the union
proc sql ;
create table bb as
select * from first
union
select B, D, E from first
union
select C from first
;
quit;
here is where I am stuck. how to select only those IDs present in a third table.