楼主: lqiantobe
4876 11

[讨论]请教高手SAS EXAM 2题 [推广有奖]

  • 0关注
  • 0粉丝

高中生

72%

还不是VIP/贵宾

-

威望
0
论坛币
1648 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
389 点
帖子
25
精华
0
在线时间
1 小时
注册时间
2005-3-24
最后登录
2013-6-28

楼主
lqiantobe 发表于 2007-3-7 14:11:00 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币

1.A raw data file is listed below:
----|----10---|----20---|----30
John McCloskey 35 71
June Rosesette 10 43
TinekeJones 9 37
The following SAS program is submitted using the raw data file as input:
data work.homework;
infile 'file-specification';
input name $ age height;
if age LE 10;
run;
How many observations will the WORK.HOMEWORK data set contain?

A. 0
B. 2
C. 3
D. No data set is created as the program fails to execute due to errors.
Answer: C

Why the answer is not B.2???

2.The following SAS program is submitted:
data work.test;
set work.staff (keep = jansales febsales marsales);
array diff_sales{3} difsales1 - difsales3;

array monthly{3} jansales febsales marsales;
run;
Which one of the following represents the new variables that are created?
A. JANSALES, FEBSALES and MARSALES
B. MONTHLY1, MONTHLY2 and MONTHLY3
C. DIFSALES1, DIFSALES2 and DIFSALES3
D. DIFF_SALES1, DIFF_SALES2 and DIFF_SALES3

Answer: C

I think if use ARRAY to create new var. it does not include elements list.Here two array statement all include elements name,how to get c is correct answer??

3xxxxx guys

二维码

扫码加我 拉你入群

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

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

关键词:Exam 请教高手 observations observation represents 请教 讨论 高手 Exam SAS

回帖推荐

Vulpecula 发表于8楼  查看完整内容

首先明确set work.staff (keep = jansales febsales marsales);的意思是说,在引用数据集的过程中仅保留这些变量:jansales、febsales和marsales。而array monthly{3} jansales febsales marsales;是SAS中建立数组的规则:array表示这个是数组;monthly表示数组的名字;{3}表示数组的维数是3,也就是包含的变量的个数是3;最后3个名字表示这3个变量分别叫jansales、febsales和marsales。 由于同一数据集中不允许有同名变量,而在当 ...

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

A 1: The condition statment is "age LE 10". If you run the program, you will find that age value should be: #1 . (missing) #2 . (missing) #3 9 missing valud always less than any number. That means the the age value in three obs are less than 10. So the answer is C.

本帖被以下文库推荐

沙发
nktiger1 发表于 2007-3-7 17:59:00
A 1:
The condition statment is "age LE 10".
If you run the program, you will find that age value should be:
#1 . (missing)
#2 . (missing)
#3 9

missing valud always less than any number.
That means the the age value in three obs are less than 10.
So the answer is C.

已有 1 人评分经验 论坛币 收起 理由
bakoll + 2 + 10 热心帮助其他会员

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

藤椅
lqiantobe 发表于 2007-3-8 05:28:00

o...... i got it.

then who can help me out for Q2?

Thanks so so much

板凳
Vulpecula 发表于 2007-3-8 09:03:00

work.staff 中只有三个月各自的销量被引入,后来被这三个变量被组成了monthly{3}。而“array diff_sales{3} difsales1 - difsales3;”又创造了一个三维的数组,包含三个新的变量difsales1 - difsales3。现在问谁是命令提交后的新变量,因此应该是C。楼主使用的element在这里的含义可能有些模糊,纵向element是变量Var,横向的element是观测Obs。规则是可以有变量而没有观测(缺失),但不能有观测却不知属于哪个变量。所谓数组,本身就是“若干个变量的集合”,因此它里面的element就是一个一个的变量,在定义的时候也需要指出各变量名。当然,数组的建立不会创造新的Obs,因为它处理的对象并非“最基层”的具体数据。

报纸
lqiantobe 发表于 2007-3-8 13:55:00

firstly,thanks for u explanation,但我还是有点模糊.

你是如何知道 work.staff 中三个变量(三个月各自的销量) 是被引入的,而“array diff_sales{3} difsales1 - difsales3;”是创造了一个三维的数组,而不是引入变量

地板
nktiger1 发表于 2007-3-8 14:25:00
Notice the statement below:
set work.staff (keep = jansales febsales marsales);

This means the variables from the dataset work.staff are three (jansales febsales marsales);
So the variables difsales1 - difsales3 should be created at present.

7
jennifer502 发表于 2007-3-8 16:11:00

上一楼主的意思是: 根据keep statement来判断 是新建的var.还是已经存在的麽?

8
Vulpecula 发表于 2007-3-8 16:25:00

首先明确set work.staff (keep = jansales febsales marsales);的意思是说,在引用数据集的过程中仅保留这些变量:jansales、febsales和marsales。而array monthly{3} jansales febsales marsales;是SAS中建立数组的规则:array表示这个是数组;monthly表示数组的名字;{3}表示数组的维数是3,也就是包含的变量的个数是3;最后3个名字表示这3个变量分别叫jansales、febsales和marsales。

由于同一数据集中不允许有同名变量,而在当前数据集work.homework中,因为之前的set...(keep=...);那句命令已经引进了这3个名字的变量,所以这里就直接将这3个变量组成一个数组了。而array diff_sales{3} difsales1 - difsales3;中所涉及的3个变量名difsales1、difsales2和difsales3则是当前数据集中所没有的,因此就认为是在创造新数组的同时也创造了新的变量。

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

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

9
lqiantobe 发表于 2007-3-9 05:54:00

很详细的解释,有点明白了

10
weihancool 发表于 2007-3-12 10:58:00

我第二题是知道什么意思的,有哪位帮我解释一下第一题呀?多谢啦

国士无双

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

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