由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - 也问几道SAS base 题目
相关主题
请教SAS BASE 70题里的第17题请问sas中一个变量的内容被两个左斜杠(/)分成了三部分
请教一个SAS BASE题请教SAS BASE 70题里的第59题
help! SAS base 70 problem 17/35修改再问:如何read multiple lines into one record and missing value at the same time in sas
请教下SAS Base 70题的第59题请问一道sas base的题
Base问题请教请教两个关于SAS的问题
但谁能解释下truncover 吗?问个SAS 数据读入的问题
请教一道sas base题A SAS infile problem
小包子:怎么读一个文件中的两个不同的delimiters请教一个SAS数据input的问题
相关话题的讨论汇总
话题: state话题: color话题: type话题: city话题: region
进入Statistics版参与讨论
1 (共1页)
s*******r
发帖数: 769
1
1. 为什么是A? 是不是State='CA'后面少了一个“;”?
data WORK.GEO;
infile datalines;
input City $20.;
if City='Tulsa' then
State='OK';
Region='Central';
if City='Los Angeles' then
State='CA'
Region='Western';
datalines;
Tulsa
Los Angeles
Bangor
;
run;
After data step execution, what will data set WORK.GEO contain?
A.
City State Region
s*******r
发帖数: 769
2
为什么选D?
----+----10---+----20---+----30
daisyyellow
The following SAS program is submitted:
data FLOWERS;
infile 'TYPECOLOR.DAT' truncover;
length
Type $ 5
Color $ 11;
input
Type $
Color $;
run;
What are the values of the variables Type and Color?
A. Type=daisy, Color=yellow
B. Type=daisy, Color=w
C. Type=daisy, Color=daisyyellow
D. Type=daisy, Color=
a****m
发帖数: 693
3
the first question:
each semicolon represents one statement,it is independent with if then
statement, therefore all region=western:
no matter you add semi or not
s*******r
发帖数: 769
4
是不是State='CA'后面应该有一个“;”?

【在 a****m 的大作中提到】
: the first question:
: each semicolon represents one statement,it is independent with if then
: statement, therefore all region=western:
: no matter you add semi or not

s********e
发帖数: 323
5
I have the same question here. Anyone knows the answer?
Thanks a lot.

【在 s*******r 的大作中提到】
: 为什么选D?
: ----+----10---+----20---+----30
: daisyyellow
: The following SAS program is submitted:
: data FLOWERS;
: infile 'TYPECOLOR.DAT' truncover;
: length
: Type $ 5
: Color $ 11;
: input

b******e
发帖数: 539
6
1. 现在的程序根本不会有结果,'CA'后面必须有‘;’
改好后建议研究一下if statement。有两种情况:
(1) if ... then ...;
(2) if ... then do; ...; end;
2. 建议研究一下output statement。每个output statement都会往output data sets
里面写一遍。前面两个output statement是有条件的,所以只有符合条件的才会往它指
定的output data sets里面写。最后一个是无条件的,也没说明要往哪个data set里写
,所以会往所有的data sets里面写。
3. by default, SAS uses blank as a delimiter. Since there is no special
delimiter specified, and the program does not specify how many characters
should be read in (in the input statement,) it r
a****m
发帖数: 693
7
good job!
3x
s********e
发帖数: 323
8
Thanks a lot.
But I am still a little confused. For Question #2, after I read your
explaination, I understand why there are 5 obs in ONE and TWO, but why there
is 3 obs in OTHER?

sets

【在 b******e 的大作中提到】
: 1. 现在的程序根本不会有结果,'CA'后面必须有‘;’
: 改好后建议研究一下if statement。有两种情况:
: (1) if ... then ...;
: (2) if ... then do; ...; end;
: 2. 建议研究一下output statement。每个output statement都会往output data sets
: 里面写一遍。前面两个output statement是有条件的,所以只有符合条件的才会往它指
: 定的output data sets里面写。最后一个是无条件的,也没说明要往哪个data set里写
: ,所以会往所有的data sets里面写。
: 3. by default, SAS uses blank as a delimiter. Since there is no special
: delimiter specified, and the program does not specify how many characters

j*******2
发帖数: 309
9
最后一句不指定输出文件,就给三个文件都输出。最后结果就是每个observation都
output到other
里一次

there

【在 s********e 的大作中提到】
: Thanks a lot.
: But I am still a little confused. For Question #2, after I read your
: explaination, I understand why there are 5 obs in ONE and TWO, but why there
: is 3 obs in OTHER?
:
: sets

s********e
发帖数: 323
10
Yeah, in that case, OTHER should have 6 obs.
Is the answer wrong?

【在 j*******2 的大作中提到】
: 最后一句不指定输出文件,就给三个文件都输出。最后结果就是每个observation都
: output到other
: 里一次
:
: there

相关主题
但谁能解释下truncover 吗?请问sas中一个变量的内容被两个左斜杠(/)分成了三部分
请教一道sas base题请教SAS BASE 70题里的第59题
小包子:怎么读一个文件中的两个不同的delimiters修改再问:如何read multiple lines into one record and missing value at the same time in sas
进入Statistics版参与讨论
b******e
发帖数: 539
11
why 6? other contains every record in SASDATA.TWO and only those records,
so it's 3.

【在 s********e 的大作中提到】
: Yeah, in that case, OTHER should have 6 obs.
: Is the answer wrong?

s********e
发帖数: 323
12
OK, so you think that's 3 pairs of obs?
ONE and TWO read X and Y seperately so that's why both have 5.
Is that right?
Thanks a lot.

【在 b******e 的大作中提到】
: why 6? other contains every record in SASDATA.TWO and only those records,
: so it's 3.

s*******r
发帖数: 769
13
谢谢,都明白了

sets

【在 b******e 的大作中提到】
: 1. 现在的程序根本不会有结果,'CA'后面必须有‘;’
: 改好后建议研究一下if statement。有两种情况:
: (1) if ... then ...;
: (2) if ... then do; ...; end;
: 2. 建议研究一下output statement。每个output statement都会往output data sets
: 里面写一遍。前面两个output statement是有条件的,所以只有符合条件的才会往它指
: 定的output data sets里面写。最后一个是无条件的,也没说明要往哪个data set里写
: ,所以会往所有的data sets里面写。
: 3. by default, SAS uses blank as a delimiter. Since there is no special
: delimiter specified, and the program does not specify how many characters

s********e
发帖数: 323
14
我还没搞明白:(

【在 s*******r 的大作中提到】
: 谢谢,都明白了
:
: sets

l******n
发帖数: 45
15
虽然已经考完了,三题都有碰到。但第二个当时答错了。。现在终于明白了,哈哈
1 (共1页)
进入Statistics版参与讨论
相关主题
请教一个SAS数据input的问题Base问题请教
SAS BASE 70 第 48 题答案是啥?但谁能解释下truncover 吗?
求一段SAS code请教一道sas base题
请教个有关SAS 的问题小包子:怎么读一个文件中的两个不同的delimiters
请教SAS BASE 70题里的第17题请问sas中一个变量的内容被两个左斜杠(/)分成了三部分
请教一个SAS BASE题请教SAS BASE 70题里的第59题
help! SAS base 70 problem 17/35修改再问:如何read multiple lines into one record and missing value at the same time in sas
请教下SAS Base 70题的第59题请问一道sas base的题
相关话题的讨论汇总
话题: state话题: color话题: type话题: city话题: region