i******r 发帖数: 861 | 1 data A;
Input x1 $ y1;
Cards;
A 10
B 20
C 30
;
Run;
Data B;
Input x2 $ y2;
Cards;
A 1
C 8
D 9
;
Run;
希望得到:
x1 y1 x2 y2
A 10 a 1
B 20 . .
C 30 C 8
. . D 9
我希望用hash table的方法 |
b*********n 发帖数: 2975 | 2 Hash table不是这么玩儿的, 你这个用merge 就行了 |
i******r 发帖数: 861 | 3 能不能够哪怕提示一下怎么写啊?google不到任何code写法
【在 b*********n 的大作中提到】 : Hash table不是这么玩儿的, 你这个用merge 就行了
|
R*****d 发帖数: 420 | 4 我觉得用sql full outer join 也可以。
select a.col1, a.col2, b.col1, b.col2 from tableA a full outer join tableB b
on a.col1=b.col1; something like this.
sas sql should have it.
【在 i******r 的大作中提到】 : 能不能够哪怕提示一下怎么写啊?google不到任何code写法
|
S******3 发帖数: 66 | 5 SAS hash can do inner join/left join easily.
just for learning purpose, full join is simply a left join + all records in
2nd table that can't be found in the 1st table. By this way, you need load
both table into hash (one full table + one table with key only); and you
need scan both tables once completely, so may not worth much of Hash. |
i******r 发帖数: 861 | 6 我也是这么想。我可以写出left join来得到你说的第一个table,但是怎么得到第二个
呢?需要iter吗?你能不能写一个code?帮帮我们这些初学者,也可以提高这里的份量啊
in
【在 S******3 的大作中提到】 : SAS hash can do inner join/left join easily. : just for learning purpose, full join is simply a left join + all records in : 2nd table that can't be found in the 1st table. By this way, you need load : both table into hash (one full table + one table with key only); and you : need scan both tables once completely, so may not worth much of Hash.
|