Silon.Jon 发表于 2012-9-20 18:15 
有一个新问题,要是长度不一样怎么办?
我能不能把比如
4-8位的数组成一个整数,然后先判断这个整数是否 ...
Sorry for cannot type Chinese on my computer.
Just give you a simple example and hope it helps.
data temp;
input x $;
datalines;
1234567
23456789
;
run;
data temp1;
set temp;
substring_4_8 = substr(x, 4);
* you can use other conditions;
if length(substring_4_8) = 5 then do
x1 = substr(x, 1, 3);
x2 = substr(x, 4);
end;
else do;
x1 = substr(x, 1, 4);
x2 = substr(x, 5);
end;
run;