c*********r 发帖数: 1802 | 1 没有人遇到过类似的问题吗?
data category;
set cate;
if TFW< 5 then Tlevel="W1";
else if 5<=TFW<8 then Tlevel="W2";
else if 8<=TFW<11 then Tlevel="W3";
else if 11<=TFW<14 then Tlevel="W4";
else if 14<=TFW<17 then Tlevel="W5";
else if 17<=TFW<20 then Tlevel="W6";
else if 20<=TFW<23 then Tlevel="W7";
else if 23<=TFW<26 then Tlevel="W8";
else if 26<=TFW<29 then Tlevel="W9";
else if 29<=TFW<32 then Tlevel="W10";
else if 32<=TFW<50 then Tlevel="W11";
else Tlevel="W12";
run;
proc print data=category;
by Tlevel;
ID ... 阅读全帖 |
|
k*******a 发帖数: 772 | 2 This seems to be a SAS BASe problem.
Since "W1" appears first, the length of Tlevel is 2 by default
so when you assign "W10" to it, "W10" becomes "W1"
The solution is simply use a length statement like
length Tlevel $5; |
|
|
|
G*******s 发帖数: 10605 | 5 呵呵,这么搞W10,W11的都去W1了,定义字符串变量第一次赋值会确定长度,这种情况
你要先定义长度,length Tlevel $3 就可以了 |
|