楼主: Bluewater1111
1303 4

SAS 50题的一个问题 [推广有奖]

  • 0关注
  • 1粉丝

硕士生

10%

还不是VIP/贵宾

-

威望
0
论坛币
1606 个
通用积分
2.2012
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
535 点
帖子
30
精华
0
在线时间
236 小时
注册时间
2010-12-23
最后登录
2024-9-6

楼主
Bluewater1111 在职认证  发表于 2014-6-10 14:35:43 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
请教一下,为什么city2的变量长度还是20?不是已经trim过了吗?


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

二维码

扫码加我 拉你入群

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

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

关键词:length Paris City trim Work

沙发
wwang111 发表于 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.

藤椅
hello_fj 发表于 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;

板凳
Bluewater1111 在职认证  发表于 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 ...
恩,明白了,谢谢。

报纸
Bluewater1111 在职认证  发表于 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 ...
很细致啊,我明白了,谢谢。

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-9 07:00