楼主: tntn
5615 12

请教两个sas题 [推广有奖]

  • 1关注
  • 0粉丝

高中生

42%

还不是VIP/贵宾

-

威望
0
论坛币
1 个
通用积分
0
学术水平
1 点
热心指数
1 点
信用等级
0 点
经验
483 点
帖子
24
精华
0
在线时间
17 小时
注册时间
2007-8-9
最后登录
2019-10-15

楼主
tntn 发表于 2007-11-2 04:16:00 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币

1. 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

2. The following SAS program is submitted:

data work.test;

 Title='A Tale of two cities, Charles J.Dickens';

 Word=scan(title,3,',');

run;

Which one of the following nisthe value of the variable WORD in the output data set?

A. T B. of C. Dickens D.' ' (missing character value)

多谢!

二维码

扫码加我 拉你入群

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

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

关键词:following Character Variable England Program SAS

回帖推荐

liujx80 发表于10楼  查看完整内容

以下是引用tntn在2007-11-6 4:54:00的发言:第二个可能是空格打成,了第一个还是不明白,run了以后是24,答案是正确的,可是不明白为什么 First='Ipswich, England'; City_Country=substr(First,1,7)!!','!!'England';substr(First,1,7) will give the length equivalent to the length of  the varialbe 'first', which is 16plus 1 (,)and plus 8 (England) . then it's 24.

本帖被以下文库推荐

沙发
rain958 发表于 2007-11-2 08:58:00
第一道好诡异啊 ,我怎么觉得应该是24。。。。
第二道是D吧,

藤椅
tntn 发表于 2007-11-2 11:32:00

第一个答案是d,我觉得应该是200,因为没有定义length,所以就是default length, which is 200.

第二个答案是b,我觉得应该是d

板凳
phinex 发表于 2007-11-2 14:18:00
都是D

报纸
布莱特 发表于 2007-11-2 18:10:00

第二题Word=scan(title,3,',');这个应该是有问题的,应该是Word=scan(title,3,'  ');引号‘ ’中间应该是个空格,这个参数的意思你采用什么作为分隔符。

这样最后的结果是 of

高人阿!后面的几位。

[此贴子已经被作者于2007-11-7 14:15:00编辑过]

地板
binstdio 在职认证  发表于 2007-11-2 20:57:00

为什么我直接length(City_County)=15?

大家19,24怎么算的?

后面那个是blank

7
sunnygeng 发表于 2007-11-4 10:15:00
太简单了,放在SAS里RUN一下不就有答案了?

8
tntn 发表于 2007-11-6 04:54:00

第二个可能是空格打成,了

第一个还是不明白,run了以后是24,答案是正确的,可是不明白为什么

9
tntn 发表于 2007-11-6 04:56:00
知道了。多谢大家

10
liujx80 发表于 2007-11-7 05:54:00
以下是引用tntn在2007-11-6 4:54:00的发言:

第二个可能是空格打成,了

第一个还是不明白,run了以后是24,答案是正确的,可是不明白为什么

 First='Ipswich, England';

 City_Country=substr(First,1,7)!!','!!'England';

substr(First,1,7) will give the length equivalent to the length of  the varialbe 'first', which is 16

plus 1 (,)and plus 8 (England) . then it's 24.

已有 1 人评分经验 论坛币 收起 理由
bakoll + 3 + 10 精彩帖子

总评分: 经验 + 3  论坛币 + 10   查看全部评分

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

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