楼主: atmosphere7
4172 6

[原创博文] 请教SAS Base123中的2道题 [推广有奖]

  • 0关注
  • 0粉丝

高中生

17%

还不是VIP/贵宾

-

威望
0
论坛币
19 个
通用积分
0
学术水平
0 点
热心指数
1 点
信用等级
0 点
经验
319 点
帖子
27
精华
0
在线时间
13 小时
注册时间
2007-3-7
最后登录
2014-8-29

楼主
atmosphere7 发表于 2011-4-2 09:10:27 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
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?

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

扫码加我 拉你入群

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

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

关键词:SAS base Base Statements Procedures following procedures statements following regarding contents

回帖推荐

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

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; dat ...

本帖被以下文库推荐

沙发
hongxx 发表于 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。
已有 1 人评分经验 论坛币 收起 理由
bakoll + 3 + 3 精彩帖子

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

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

板凳
yeisu 发表于 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

报纸
yxj985211 发表于 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楼已经解释的很清楚了,你的解释是错误的!
欢迎加入SAS群:144839730-蜗牛

7
星落荒原 发表于 2014-12-19 07:56:48
同意一楼的说法
同时补充一下, @4 weight 就可以正确读为95
ARRAY NAME 也不能用在keep中
已有 1 人评分论坛币 收起 理由
admin_kefu + 30 根据规定进行奖励

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

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

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