请选择 进入手机版 | 继续访问电脑版
楼主: 媚小妖
7933 8

[问答] 求教,50题的第41题和123题中的第112题 [推广有奖]

  • 0关注
  • 0粉丝

初中生

28%

还不是VIP/贵宾

-

威望
0
论坛币
666 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
472 点
帖子
15
精华
0
在线时间
12 小时
注册时间
2011-2-1
最后登录
2014-6-5

媚小妖 发表于 2011-2-4 04:37:50 |显示全部楼层 |坛友微信交流群

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
41.A raw data file is listed below.
1---+----10---+----20---+---
01/05/1989 Frank 11
12/25/1987 June 13
01/05/1991 Sally 9
The following SAS program is submitted using the raw data file as input:
data work.family;
infile 'file-specification';
input @1 date_of_birth mmddyy10.
@15 first_name $5.
@25 age 3;
run;
proc print data=work.family noobs;
run;
Which one of the following is the result?
a. The program executes, but the age values are missing in the output.
b. The program executes, but the date values are missing in the output.
c. The program fails to execute because the age informat is coded incorrectly.
d. The program fails to execute because the date informat is coded incorrectly.
Correct answer: a



112. The contents of the raw data file SIZE are listed below:
----|----10---|----20---|----30
72 95
The following SAS program is submitted:
data test;
infile 'size';
input @1 height 2. @4 weight 2;
run;
Which one of the following is the value of the variable WEIGHT in the output data set?
A. 2
B. 72
C. 95
D. . (missing numeric value)

Answer: A

这两个题都是input format 缺少一个. ,为什么结果不一样(上机测试结果证明答案没错),为什么@25 age 3; age的值是missing 而不是3?请高手解惑,谢谢!

测试用code:

data work.family;
input @1 date_of_birth mmddyy10.
@15 first_name $5.
@25 age 3;
cards;
01/05/1989 Frank 11
12/25/1987 June  13
01/05/1991 Sally 9
;
run;
proc print data = family;
run;

data test;
infile cards;
input @1 height 2. @4 weight 2;
cards;
72 95
;
run;
proc print data = test;
run;
二维码

扫码加我 拉你入群

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

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

关键词:following correctly informat Specific contents 求教

abc7759abc 发表于 2011-2-4 07:49:13 |显示全部楼层 |坛友微信交流群
不懂啊。。。。
历史是个什么玩意儿~

使用道具

媚小妖 发表于 2011-2-4 22:54:50 |显示全部楼层 |坛友微信交流群
没人回答吗?马上就要考了呀,呼唤高手

使用道具

hssnow 发表于 2011-2-6 14:13:46 |显示全部楼层 |坛友微信交流群
1# 媚小妖
呵呵,高手过年的时候都比较忙嘛~ 我是只菜鸟,仅说说个人理解~ :-)
这里input format读数字格式时是缺少了 “.” ,但个人认为不是将缺少 “.” 的数字当数值直接赋给前面的变量,而是将其看做“列指针”。
112题weight之所以是2,并不是把“input @1 height 2. @4 weight 2;”最后的那个2赋给weight,而是最后的“2”指到了“72”的“2”,如果改为“input @1 height 2. @4 weight 1;”那么weight就是7了,可以自己测试下~
41题得age就当然不是3了,之所以是missing是因为“@25 age 3;”的“3”指到第三列,即如“01/05/1989”的第3列,是“/”,对于数值型的age当然得到missing,如果改为“@25 age 2;”,测试下会发现age分别为 1,2,1了
已有 3 人评分学术水平 热心指数 信用等级 收起 理由
wodehezi007 + 1 + 1 + 1 精彩帖子
alphalex + 1 + 1 热心帮助其他会员
baoaibaobao + 1 + 1 好的意见建议

总评分: 学术水平 + 3  热心指数 + 3  信用等级 + 1   查看全部评分

My Blog: http:/hssnow.name/
宁静致远

使用道具

媚小妖 发表于 2011-2-7 01:18:49 |显示全部楼层 |坛友微信交流群
hssnow, 高人啊高人!我以前对这个列指针的理解全错了。惭愧!

上机测试结果果真如此。谢谢了

使用道具

sunset1986 发表于 2012-4-12 13:28:18 |显示全部楼层 |坛友微信交流群
thank you so much
An honest tale speeds best being plainly told.
Cheers!

使用道具

alphalex 发表于 2012-11-20 04:29:05 |显示全部楼层 |坛友微信交流群
谢谢解答啊               

使用道具

miclilu 发表于 2018-1-18 10:39:57 |显示全部楼层 |坛友微信交流群
hssnow 发表于 2011-2-6 14:13
1# 媚小妖
呵呵,高手过年的时候都比较忙嘛~ 我是只菜鸟,仅说说个人理解~ :-)
这里input format读数字 ...
高人,列指针不是都需要@和+(-)来控制吗?不太懂诶,请指点

使用道具

wodehezi007 学生认证  发表于 2018-5-26 22:02:58 |显示全部楼层 |坛友微信交流群
hssnow 发表于 2011-2-6 14:13
1# 媚小妖
呵呵,高手过年的时候都比较忙嘛~ 我是只菜鸟,仅说说个人理解~ :-)
这里input format读数字 ...
bravo!!!

使用道具

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

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-3-29 09:15