全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1269 4
2014-06-10
请教一下,为什么city2的变量长度还是20?不是已经trim过了吗?


data work.test;
length city $20;
city='Paris';
city2=trim(city);
run;

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2014-6-10 14:41:04
From SAS HELP: Assigning the results of TRIM to a variable does not affect the length of the receiving variable. If the trimmed value is shorter than the length of the receiving variable, SAS pads the value with new blanks as it assigns it to the variable.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2014-6-10 14:56:23
TRIM函数的功能是Removes trailing blanks from a character string,与变量长度无关。
data test;
a=length('Paris '||' Londen');
b=length(trim('Paris ')||trim(' Londen'));
put a=;
put b=;
run;
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2014-6-10 15:48:14
wwang111 发表于 2014-6-10 14:41
From SAS HELP: Assigning the results of TRIM to a variable does not affect the length of the receivi ...
恩,明白了,谢谢。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2014-6-10 15:48:47
hello_fj 发表于 2014-6-10 14:56
TRIM函数的功能是Removes trailing blanks from a character string,与变量长度无关。
data test;
a=le ...
很细致啊,我明白了,谢谢。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群