楼主: srorange
8373 5

[原创博文] 请教一下BASE 123里面的一些问题 [推广有奖]

  • 0关注
  • 0粉丝

大专生

18%

还不是VIP/贵宾

-

威望
0
论坛币
0 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
241 点
帖子
34
精华
0
在线时间
41 小时
注册时间
2010-1-23
最后登录
2015-11-2

楼主
srorange 发表于 2010-8-18 05:03:57 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
111. A SAS PRINT procedure output of the WORK.LEVELS data set is listed below:
OBS NAME LEVEL
1   Frank 1
2 Joan 2
3 Sui 2
4 Jose 3
5 Burt 4
6 Kelly.
7 Juan 1

set work. levels;
if level=. then
expertise='Unknown';
else if level=1 then
expertise='Low';
else if level=2 or 3 then
expertise='Medium';
else
expertise='High';
run;
答案是EXPERTISE contain Low,Medium,and Unkonwn
不明白为什么不包含 high
-----------------------------------------------------------------------------------------------------------------
87. The SAS data set BANKS is listed below:
BANKS
name rate
FirstCapital 0.0718
DirectBank 0.0721
VirtualDirect0.0728
The following SAS program is submitted:
data newbank;
do year=1 to 3;
set banks;
capital+5000;
end;
run;
答案是NEWBANK contain 1 observation and 4 variables不明白
----------------------------------------------------------------------------------------

57题明白真确答案但是不明白选项A为什么错了
题目如下
the SAS data set named WORK.TEST is listed below:
capacity airplanetype staff
150 Large 10
Which one of the following SAS programs created this data set?
A.data work.test;
capacity=150;
if 100 le capacity le 200 then
airplanetype='Large' and staff=10;
else airplanetype ='Small' and staff=5;
run;
不明白这个if then/else哪里不对
------------------------------------------------------------------

39. A raw data file is listed below:
----|----10----|----20----|----30
John McCloskey 35 71
June Rosesette 10 43
Tineke Jones 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;
答案是WORK.HOMEWORK data包含3个observations,不明白为什么不是2个。
-----------------------------------------------------------------------------------------------------------------------------

38.the SASDATA.BANKS data set has five ovservations when the following SAS program is submitted:
libname sas data' SAS0data-library';
data allobs;
set sasdata.banks;
capital=0;
do year=2000 to 2020 by 5;
capital +((capital+2000)*rate);
output;
end;
run;
How many observations will the ALLOBS data set contain?
答案是25,不明白。
-----------------------------------------------------------------------------------------

33. the contents of the raw data file TEAM are listed below:
----|----10----|----20----|----30
Janice 10
Henri 11
Michael 11
Susan 12
The following SAS program is submitted:
data group;
infile 'team';
input name $15. age 2.;
file'file-specification';
put name $15. +5 age2.;
run;
which one of the following describes the output created?
答案是a SAS data set named GROUP and a raw data file
不明白put name $15. +5 age2.;难道不是错误的么

SAS才学习了一个多月水平比较菜,无奈最近要考试,希望不吝指教,多谢
二维码

扫码加我 拉你入群

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

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

关键词:Base observations observation following Procedure procedure contain levels

沙发
pobel 在职认证  发表于 2010-8-18 08:01:56
111. A SAS PRINT procedure output of the WORK.LEVELS data set is listed below:
OBS NAME LEVEL
1   Frank 1
2 Joan 2
3 Sui 2
4 Jose 3
5 Burt 4
6 Kelly.
7 Juan 1

set work. levels;
if level=. then
expertise='Unknown';
else if level=1 then
expertise='Low';
else if level=2 or 3 then  
expertise='Medium';
else
expertise='High';
run;
答案是EXPERTISE contain Low,Medium,and Unkonwn
不明白为什么不包含 high
---------------------------------------------------------
else if level=2 or 3; 中的or 3 永远为真,所以就不会执行后面的else了,也就是expertise不会被赋值为“High”

-----------------------------------------------------------------------------------------------------------------
87. The SAS data set BANKS is listed below:
BANKS
name rate
FirstCapital 0.0718
DirectBank 0.0721
VirtualDirect0.0728
The following SAS program is submitted:
data newbank;
do year=1 to 3;
set banks;
capital+5000;
end;
run;
答案是NEWBANK contain 1 observation and 4 variables不明白

-------------------------------------------
DATA step 默认在结束时将PDV中的变量输出到数据集中,DO语句循环3次,会读banks中的3条记录,之后遇到run;时输出到newbank中。
返回到data步开头试图读数据时因为没有观测可读,所以次data步结束。
四个变量: year,name , rate, capital

----------------------------------------------------------------------------------------

57题明白真确答案但是不明白选项A为什么错了
题目如下
the SAS data set named WORK.TEST is listed below:
capacity airplanetype staff
150 Large 10
Which one of the following SAS programs created this data set?
A.data work.test;
capacity=150;
if 100 le capacity le 200 then
airplanetype='Large' and staff=10;
else airplanetype ='Small' and staff=5;
run;
不明白这个if then/else哪里不对
------------------------------------------
if 100 le capacity le 200 then do;
         airplanetype='Large';
         staff=10;
   end;
else do;

      airplanetype ='Small';
     staff=5;
end;


------------------------------------------------------------------

39. A raw data file is listed below:
----|----10----|----20----|----30
John McCloskey 35 71
June Rosesette 10 43
Tineke Jones 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;
答案是WORK.HOMEWORK data包含3个observations,不明白为什么不是2个。
----------------------------------
因为名字包含空格,读入后变量name只包含名字的第一个单词,age为数值型变量,却试图读入字符型的值,因此自动设为缺失值,
缺失值都小于10,因此会有3条

-----------------------------------------------------------------------------------------------------------------------------

38.the SASDATA.BANKS data set has five ovservations when the following SAS program is submitted:
libname sas data' SAS0data-library';
data allobs;
set sasdata.banks;
capital=0;
do year=2000 to 2020 by 5;
capital +((capital+2000)*rate);
output;
end;
run;
How many observations will the ALLOBS data set contain?
答案是25,不明白。
--------------------------------------------
对于banks的每一条记录,DO;END; 语句循环5次,就会有5次output;
所以会有5*5=25条记录。

-----------------------------------------------------------------------------------------

33. the contents of the raw data file TEAM are listed below:
----|----10----|----20----|----30
Janice 10
Henri 11
Michael 11
Susan 12
The following SAS program is submitted:
data group;
infile 'team';
input name $15. age 2.;
file'file-specification';
put name $15. +5 age2.;
run;
which one of the following describes the output created?
答案是a SAS data set named GROUP and a raw data file
不明白put name $15. +5 age2.;难道不是错误的么
---------------------------------------------
$15. 指定输出name时的format,

put name $15. +5 age2.;
age和2.之间没有空格么?
已有 2 人评分学术水平 热心指数 信用等级 收起 理由
hopewell + 1 + 1 + 1 真勤劳,打那么多的自
srorange + 1 + 1 thx

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

和谐拯救危机

藤椅
srorange 发表于 2010-8-18 08:44:30
谢谢LS

age和2.之间有空格的
put name $15. +5 age 2.;
这个是指15个字符后再移动五个字符再输入age么
或者是输入name之后移动5个空格?
这样不是超过age的范围了么,是变成missing data么

板凳
pobel 在职认证  发表于 2010-8-18 09:10:24
srorange 发表于 2010-8-18 08:44
谢谢LS

age和2.之间有空格的
put name $15. +5 age 2.;
这个是指15个字符后再移动五个字符再输入age么
或者是输入name之后移动5个空格?
这样不是超过age的范围了么,是变成missing data么
中间没有空格会报错。

+5 是指15个字符后再加五个空格再输出age。
输出的时候是从pdv中拿出相应的变量,再放到指定的地方,与变量的位置和长度是没有关系的。
data test;
   input name $5. age;
   put age 2. +10 name $10. +10 age 2.;
   datalines;
Tom  13
Jack 24
;
和谐拯救危机

报纸
srorange 发表于 2010-8-18 09:25:13
put的问题明白了
else if level=2 or 3; 中的or 3 永远为真,所以就不会执行后面的else了,也就是expertise不会被赋值为“High”
能问最后一个问题么,为什么or 3永远为真

地板
pobel 在职认证  发表于 2010-8-18 10:02:26
srorange 发表于 2010-8-18 09:25
put的问题明白了
else if level=2 or 3; 中的or 3 永远为真,所以就不会执行后面的else了,也就是expertise不会被赋值为“High”
能问最后一个问题么,为什么or 3永远为真
If condition1 or condition2 then ...

这一句中condition1 和condition2有一个为真时,就会执行then后面的语句。
而对于每一个条件,只要其结果非0就认为是真。
condition1: level=2     当变量level的值是2时为真,否则为假;
condition2: 3,    非零,所以永远为真

这个题考的是阅读理解,不是sas水平。
已有 1 人评分论坛币 收起 理由
bianyue + 5 精彩帖子

总评分: 论坛币 + 5   查看全部评分

和谐拯救危机

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

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