SAS中文论坛

 找回密码
 立即注册

扫一扫,访问微社区

查看: 1658|回复: 1
打印 上一主题 下一主题

请教一道sas base题目

[复制链接]

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
楼主
 楼主| 发表于 2012-9-2 19:28:45 | 只看该作者

请教一道sas base题目

1901 2
1905 1
1910 6
1925 .
1941 1
the following sas program is submitted and reference the raw data above:
data coins;
infile 'file';
input year quantity;
<insert statement here>
run;
which one of the following complete the program and produce a nonmissing value for the variable Totalquantity in the last observation of the output dataset?

A. totalquantity+quantity;
B. totalquantity=sum(totalquanity+quantity);
C. totalquantity 0;
sum totalquantity;
D. retain totalquantity 0;
totalquantity=totalquantity+quantity;
答案是A。可我觉得A和D是等价的。我看书上说A语句等价于
retain totalquantity 0;
totalquantity=sum(totalquantity,quantity);
上面这句话不就是D选项的第二个语句吗?
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
沙发
 楼主| 发表于 2012-9-3 12:57:23 | 只看该作者

Re: 请教一道sas base题目

我懂了好像。因为在a=a+b的情况下,如果a或b出现missing value,那么a的值就为missing. 但sum语句自动忽略missing值
回复 支持 反对

使用道具 举报

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

本版积分规则

QQ|小黑屋|手机版|Archiver|SAS中文论坛  

GMT+8, 2025-5-3 08:38 , Processed in 0.080906 second(s), 19 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表