data a;
set test;
length ch2 $50;
ch2='';
do i=1 to length(compress(char));
ch1=substr(char,i,1);
if ch1*1<0 and compress(ch1)^='.' then do;
ch1='-';
end;
ch2=compress(ch2)||put(ch1,1.0);
output;
end;
drop i;
run;
proc sort data=a;
by no;
run;
data a;
set a;
by no;
if last.no;
run;
data a2;
set a;
j=length(compress(ch2))-length(compress(ch2,'-'));
run;
proc sql;
create table a3 as select max(j) as n from a2;
run;
data a3;
set a3;
call symput('max',n);
run;
%macro char(i);
data a4;
set a2;
do &i=1 to &max;
char1=scan(ch2,&i,'-');
output;
end;
run;
data a4;
set a4;
if compress(char1)='' then delete;
keep no char char1;
run;
data test;
merge test a4;
by no;
drop no;
run;
%mend;