z****n 发帖数: 67 | 1 题目1:
data w;
first="ipswich, england";
c_c=substr(first,1,7)!!','!!'english';
run;
proc contents data=w; run;
上面这段程序为什么c_c的长度是24呢?我觉得应该是7+1+7=15.
题目2:
data u;
author="agatha christie";
first=substr(scan(author,1,','),1,1);
run;
proc contents data=u; run;
上面这段程序为什么first的长度是200呢?我觉得应该是1.
多谢! | s*******f 发帖数: 148 | 2 The SCAN function causes SAS to assign a length of 200 bytes to the target
variable in an assignment statement. Most other character functions cause
the target to have the same length as the original value, such as SUBSTR.
For the first question, the length is 16(original)+1+7=24. | d*******o 发帖数: 493 | 3 Are you sure that you used || instead of !! |
|