楼主: chasedreamtrue
1890 1

[求助]a question about do loop [推广有奖]

  • 0关注
  • 0粉丝

本科生

78%

还不是VIP/贵宾

-

威望
0
论坛币
123 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
781 点
帖子
82
精华
0
在线时间
12 小时
注册时间
2007-7-30
最后登录
2010-10-24

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
 The SAS data set BANKS is listed below:
BANKS
name rate
FirstCapital 0.0718
DirectBank 0.0721
VirtualDirect 0.0728
The following SAS program is submitted:
data newbank;
do year = 1 to 3;
set banks;
capital + 5000;
end;
run;
Which one of the following represents how many observations and variables
will exist in the SAS data set NEWBANK?
A. 0 observations and 0 variables
B. 1 observations and 4 variables
C. 3 observations and 3 variables
D. 9 observations and 2 variables
Answer: B

如果把 set banks 放到do year=1 to 3前面的话就是3 observations and 4
variables

为什莫呢?谢谢
二维码

扫码加我 拉你入群

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

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

关键词:question About Quest loop Bout question loop

回帖推荐

SignPingGu 发表于2楼  查看完整内容

I have verified the answer.- When 'set banks' is put after the do-loop, the loop repeats for each observation of newbank. B/C newbank is new one, therefore, there would be only one observation;- When 'set banks' is put before the do-loop, the loop repeats for each observation of banks. B/C banks has three observations, therefore, there would be 3 observations;In both cases, the extra variable is ' ...

本帖被以下文库推荐

沙发
SignPingGu 发表于 2008-8-12 09:57:00 |只看作者 |坛友微信交流群
I have verified the answer.

- When 'set banks' is put after the do-loop, the loop repeats for each observation of newbank. B/C newbank is new one, therefore, there would be only one observation;
- When 'set banks' is put before the do-loop, the loop repeats for each observation of banks. B/C banks has three observations, therefore, there would be 3 observations;

In both cases, the extra variable is 'Year'.

Hope it helps

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

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

使用道具

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

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

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

GMT+8, 2024-4-28 06:13