|
|
Re: 求助,数据合并
鄙人觉得这种操作比较SASsy
[code:reu9h6oj]
data a;
input x :$20. val;
cards;
aaa 1
bbb 2
aaa,bbb,ccc 3
fff,aaa,bbb,ccc 4
fff,aaa,bbb,ccc 4
ddd 4
ddd,eee 5
fff 6
;
run;
data master sat(index=(x1) rename=(x=x1 val=val1));
set a;
if find(x, ',')>0 then output master;
else output sat;
run;
data master;
modify master;
i=1;
x1=scan(x, i, ',');
do while (x1^='');
do until (_iorc_=%sysrc(_dsenom));
set sat key=x1;
select (_iorc_);
when(%sysrc(_sok)) val=val+val1;
when(%sysrc(_dsenom)) _error_=0;
otherwise put "ERROR: I/O MALFUNCTION";
end;
end;
i=i+1;
x1=scan(x, i, ',');
end;
run;
[/code:reu9h6oj] |
|