|
|
Re: 如何对两个数据集进行比对?
刚发现我程序多贴了一段没有用的(生成max min 的data那段……),不好意思,可能误导你了
其实我前面的步骤就是生成一个max,min的summary,既然a已经给出了max,min,就更方便了。
[code:u7c6zwij]data a;
input var $ RBC PLT ALT BUN;
cards;
min 3.5 100 0 2.5
max 5.5 300 40 7.8
;
run;
data b;
input center$ number$ RBC PLT ALT BUN;
cards;
1 1 6 240 58 5.7
1 2 4.5 450 20 2.8
2 3 3.4 98 23 9.5
2 4 5.6 230 50 3.8
3 5 6.2 320 100 1.5
3 6 4.5 200 21 3.9
;
run;
data _null_;
set a;
if upcase(var) in ('MIN') then do;
call symput('min',catx(',',of _numeric_));
end;
if upcase(var) in ('MAX') then do;
call symput('max',catx(',',of _numeric_));
end;
run;
data y;
set b;
array big{4} _temporary_ (&max);
array small(4) _temporary_ (&min);
array temp(*) _numeric_;
do i=1 to dim(temp);
if temp(i)>= big(i) or temp(i)<= small(i);
end;
drop i;
run; [/code:u7c6zwij] |
|