zoumingwang2004 发表于 2010-8-18 23:11
data work.test;
length city $20;
city = 'Paris ';
city2 = trim(city);
run;
则city2的length是多少?
用length函数求的是5.是这样吗?
我的理解为city的length声明为20,但是对于city变量的赋值为'Pairs '
则city变量的length还是20吗?用length函数为5这样就矛盾了吗????
还有对于trim函数的结果长度为city变量的长度是20吗?所以最后的而结果为20。各位是这样吗?谢谢高手解析解析这个过程!!!!
The length statement vs. length function.
The length statement provides descriptive information about variables and use in program compiling phase. It is one of a few non-executable statement.
Length function is just a char function. But the example below deserves to remember,
101 data _null_;
102 x=' ';
103 y=length(x);
104 put x= y=;
105 x='1 ';
106 y=length(x);
107 put x= y=;
108 run;
x= y=1
x=1 y=1