|
沙发

楼主 |
发表于 2012-5-27 11:54:05
|
只看该作者
Re: 数据合并问题
如果a是111,该怎么取? 是1还是11?
[code:1lhp3jit]data raw;
infile datalines missover;
input A B;
datalines;
12 1
13
14 1
15 1
21 1
22 1
23 1
24 1
31 1
32 1
41 1
42
43 1
;
data _null_;
if _n_=1 then do;
declare hash h(hashexp:4,ordered:'y');
rc=h.defineKey('a');
rc=h.defineData('a','b');
rc=h.defineDone();
end;
set raw end=last;
a=int(a/10); _b=b;
if h.find() ne 0 then rc=h.add();
else if b then rc=h.replace(key:a,data:a,data:_b);
if last then rc=h.output(dataset:'work.out');
run;
[/code:1lhp3jit] |
|