刚学sas,用循环搞了个极其麻烦的做法………………
data temp;
infile 'D:\sas学习\exp.txt';
length a $30.;
input a $;
do i=1 to 5;
b=scan(a,i,'[]');
if b ^= ',' then
output;
end;
run;
data temp1(keep=x1-x5);
set temp;
array c(5)$5. x1-x5;
if substr(b,length(b),1)=',' then c(5)=.;
else c(5)=substr(b,length(b),1);
j=1;
do while (j<=4);
i=1;
do while( i<=length(b));
if substr(b,i,1)=',' then do;
if i=1 then do; c(j)=.; j=j+1; end;
else if substr(b,i,1)=','& substr(b,i-1,1)=',' then do; c(j)=.; j=j+1; end;
else do; c(j)=substr(b,i-1,1); j=j+1; end;
end;
i=i+1;
end;
end;
output;
run;


雷达卡
)
京公网安备 11010802022788号







