全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
10991 13
2014-01-21
两个题目都是有关变量长度的问题
QUESTION 73
The following SAS program is submitted:
data work.test;
First = 'Ipswich, England';
City_Country= substr(First,1,7)!!', '!!'England';
run;
Which one of the following is the length of the variable CITY_COUNTRY in the
output data set?
A. 6
B. 7
C. 17
D. 25
Answer: D

QUESTION 76
The following SAS program is submitted:
data work.test;
Author = 'Agatha Christie';
First = substr(scan(author,1,' ,'),1,1);
run;
Which one of the following is the length of the variable FIRST in the output data
set?
A. 1
B. 6
C. 15
D. 200
Answer: D
没太搞明白,哪位大侠给解释下。


二维码

扫码加我 拉你入群

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

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

全部回复
2014-1-21 15:31:54
来自SAS help:
If the SUBSTR function returns a value to a variable that has not yet been assigned a length, by default the variable length is determined by the length of the first argument.

变量first的长度是16,后面连接的总长度是9.
二维码

扫码加我 拉你入群

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

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

2014-1-21 15:45:49
wwang111 发表于 2014-1-21 15:31
来自SAS help:
If the SUBSTR function returns a value to a variable that has not yet been assigned  ...
前边first变量长度好像是15吧@
二维码

扫码加我 拉你入群

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

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

2014-1-21 15:47:33
木颜夕 发表于 2014-1-21 15:45
前边first变量长度好像是15吧@
逗号和e之间有一个空格
二维码

扫码加我 拉你入群

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

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

2014-1-21 15:52:06
wwang111 发表于 2014-1-21 15:47
逗号和e之间有一个空格
能帮忙解释一下76吗,谢啦
二维码

扫码加我 拉你入群

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

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

2014-1-21 15:58:03
木颜夕 发表于 2014-1-21 15:52
能帮忙解释一下76吗,谢啦
SAS help:If the SCAN function returns a value to a variable that has not yet been assigned a length, by default the variable is assigned a length of 200.
二维码

扫码加我 拉你入群

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

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

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

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