data one;
input code $;
cards;
a001
a002
a003
a005
a008
a009
a100
a200
abcd
;;;
data two;
input code $ month value;
cards;
a001 1 10
a002 2 11
a003 3 13
a005 4 14
a008 5 45
a009 6 23
a100 7 33
a200 8 34
a300 9 44
;;;
proc sql;
create table result(drop=code2) as
select one.code ,two.*
from one
left join
two(rename=(code=code2))
on one.code=two.code2
order by code;
quit;
你按照这个运行看看结果是不是你想要的,我是假设如果表一有些代码不在表二中,代码也会被保留下来,只不过后面所有的值都显示缺失。
|