全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
4141 6
2011-04-02
QUESTION 47
Which one of the following statements is true regarding the name of a SAS array?
A. It is saved with the data set.
B. It can be used in procedures.
C. It exists only for the duration of the DATA step.
D. It can be the same as the name of a variable in the data set.
Answer: C


我承认我在书上没见过array用于proc step,但不明白为什么?

-------------------------------------------------------------------------------------
QUESTION 112
The contents of the raw data file SIZE are listed below:
----|----10---|----20---|----30
72 95
The following SAS program is submitted:
data test;
in file 'size';
input@ 1 height 2.@ 4 weight 2;
run;
Which one of the following is the value of the variable WEIGHT in the output data
set?
A. 2
B. 72
C. 95
D. . (missing numeric value)

Answer: A
我用sas运行过结果的确是A,但不明白为什么?难道input可以assign  value给variable?

----------------------------------------------------------------------------------------------------------------------
多谢!!!
二维码

扫码加我 拉你入群

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

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

全部回复
2011-4-4 00:57:41
Array Name不能是SAS数据集里的变量名或者函数名。Array Name只是对变量分组的一个代号,不实际存储在数据集里,Array里的Array Elements,即Variables,会成为SAS数据集里的变量。

@4 weight 2;
这里的2由于不是格式,SAS 用column input来读取Weight,从而指针跑到第二列开始读取,当没有指定截止列数时,只读取一列,从而读到的是92 的第二列,2。

data test;
infile datalines;
input @1 height 2. @4 weight 2;
datalines;
78 94
;

weight读到就是8了,而不是2。
二维码

扫码加我 拉你入群

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

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

2011-4-4 10:31:47
谢谢上面的解释,@n 表示从指定的列号开始读,@ 1 height 2. 是否表示第一列读取到第二列,最后的点号好像不能少,它的作用是否就是只是最后列的范围?
二维码

扫码加我 拉你入群

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

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

2011-4-5 15:26:38
楼上的回答错了,第二个数据是95 ,怎么可能读出2来呢?
正确的是@4 weight 2; miss 了 period, so; you just input weight=2; 将weight直接等于2了, 如果换成文本你就更加明白了 weight '2';

that's my two cents.

Tks
二维码

扫码加我 拉你入群

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

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

2011-4-6 10:18:16
??????????????????????????
二维码

扫码加我 拉你入群

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

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

2012-10-14 09:29:31
yeisu 发表于 2011-4-5 15:26
楼上的回答错了,第二个数据是95 ,怎么可能读出2来呢?
正确的是@4 weight 2; miss 了 period, so; you j ...
1楼已经解释的很清楚了,你的解释是错误的!
二维码

扫码加我 拉你入群

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

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

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群