1 2001 A
2 2001 A
3 2001 A
5 2001 A
7 2001 A
id year state
2 2002 B
4 2002 B
5 2002 B
6 2002 B
想要结果
id year state
2 2001 A
2 2002 B
5 2001 A
5 2002 B
我用
data test1;
input id year state$5.;
cards;
1 2001 A
2 2001 A
3 2001 A
4 2001 A
7 2001 A
run;
data test2;
input id year state$5.;
cards;
2 2002 B
4 2002 B
5 2002 B
6 2002 B
;run;
data need;
merge test1(in=x) test2(in=y);
by id;
if x=1 and y=1;
run;
只能得到
id year state
2 2002 B
5 2002 B
沒有了2001年的部分



雷达卡





京公网安备 11010802022788号







