y**3 发帖数: 267 | 1 I have two data sets;
ID month1
1 2
1 4
2 3
2 7
2 9
data set 2:
ID month2
1 1
1 2
1 3
1 4
1 5
2 1
etc
Wanna merge to:
ID month1 month2
1 . 1
1 2 2
1 . 3
1 4 4
1 . 5
2 . 1
etc
thanks | a****g 发帖数: 8131 | 2 proc sql full join
【在 y**3 的大作中提到】 : I have two data sets; : ID month1 : 1 2 : 1 4 : 2 3 : 2 7 : 2 9 : data set 2: : ID month2 : 1 1
| y**3 发帖数: 267 | 3 thanks!! it worked
proc sql;
create table both(DROP=oldID) as
select coalesce(ONE.oldID,TWO.oldID) AS ID,
*
from one (RENAME=(ID=oldID)) full join two(RENAME=(ID=oldID))
on (one.oldid =two.oldid and one.month1=two.month2)
;
quit;
【在 a****g 的大作中提到】 : proc sql full join
|
|