data readin(keep=id no);
DataAll = "a 2 b 3 c d 4 6"; /* LZ - Please use whatever way you like to import all your data into this one character variable */
do i = 1 to length(DataAll) by 1;
j = i+2;
if j>length(DataAll) then leave;
if ((substr(DataAll, i, 1) in ("a" "b" "c" "d" "e" "f" "g" "h" "I" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z")) and (substr(DataAll, j, 1) in ("0" "1" "2" "3" "4" "5" "6" "7" "8" "9"))) then do;
id = substr(DataAll, i, 1);
no = input(substr(DataAll, j, 1), best12.);
output;
end;
end;
run;
这是作业题还是什么?如果作业要求一定要用input id$ no来导入数据的话,那我的方法就不合要求了。如果是实际应用,我的方法是可以运行无误的。
[此贴子已经被作者于2008-10-11 2:35:52编辑过]