y****t 发帖数: 446 | 1 batch number 可能是A1,A2,B1,B2,C,D,E, 其中A1和A2,B1和B2有关联
dataset有可能是:
batch number response
A1
B2
C
D
E
如果是这种情况则不需要任何action
但如果dataset是如下情况:
batch number response
A1
A2
C
D
E
则需要把A1,A2的数据和其他数据分离出来
请问给定一个dataset后如何自动判断并采取对应的action,谢谢! | j******o 发帖数: 127 | 2 也许你可以新建一个ariable来反映records之间的联系,这样就容易分开了。 | t*********l 发帖数: 778 | 3 prior_batchnumber=lag(batchnumber);
if batchnumber=a2 and prior_batchnumber=a1 then.... | b******e 发帖数: 539 | 4 not sure if i understand your question, but here is my thought:
create a new variable batchnumber2 = substr(batch number, 1, 1);
proc sort data=xxx; by batchnumber2; run;
data xxx (drop=batchnumber2) yyy (drop=batchnumber2);
set xxx;
by batchnumber2;
if ^(first.batchnumber2 and last.batchnumber2) then output yyy;
else output xxx;
run;
==> the updated data set xxx will contain records C, D, and E; data set yyy
will contain records A1 and A2 |
|