data have;
input ID val_202001 val_202002 val_202003 val_202004 val_202005 val_202006 val_202007 val_202008 val_202009 val_202010 val_202011 val_202012 val_202101 val_202102 val_202103 ;
cards;
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
2 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1
3 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1
4 1 1 0 0 1 1 1 1 1 1 1 1 1 0 1
5 1 1 0 0 1 1 1 1 1 1 1 1 1 0 0
6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
;
data want;
set have;
temp=cats(of val_:);
pid=prxparse('/1+/');
s=1;e=length(temp);
call prxnext(pid,s,e,temp,p,l);
do while(p>0);
want=l;
call prxnext(pid,s,e,temp,p,l);
end;
drop temp pid s e p l;
run;
... View more