楼主: LIW001
2473 10

求助data step, create a dataset with unique values ,input dataset 需求 [推广有奖]

  • 12关注
  • 0粉丝

大专生

6%

还不是VIP/贵宾

-

威望
0
论坛币
879 个
通用积分
2.0916
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
593 点
帖子
25
精华
0
在线时间
52 小时
注册时间
2013-2-15
最后登录
2024-3-9

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
请问这个题要选哪个?为什么,谢谢

Item 52
To create a dataset with unique values of a given varible using a data step and the FIRST. and LAST. variables, it isassumed that the input dataset is:
A. sorted on that variable.
B. indexed by that variable.
C. naturally in order.
D. any of the above A, B, or C

请问这个题要选哪个?为什么,谢谢




二维码

扫码加我 拉你入群

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

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

关键词:Data step dataset values Create unique naturally create values

沙发
XBoy2013 发表于 2015-5-23 10:13:17 |只看作者 |坛友微信交流群
select A.

使用道具

藤椅
siahu 发表于 2015-5-23 11:36:53 |只看作者 |坛友微信交流群
I agree on A.

Ex. datalines;
A 2
A 3
A 4
B 2
B 3
B 4 ;

First.Department = "A" is the first A
Last.Department = "A" is the last A.

The dataset has to be sorted to use them.

Just my two cents!

使用道具

板凳
就喜欢马 发表于 2015-5-23 14:02:58 |只看作者 |坛友微信交流群
SAS自带的变量first.变量和last.变量使用前提是data步中有by语句。而data步中用by语句的变量必须要在data步之前排序

使用道具

报纸
LIW001 发表于 2015-5-28 09:11:31 |只看作者 |坛友微信交流群
谢谢O(∩_∩)O~

使用道具

地板
eltonqjy 在职认证  发表于 2015-12-29 09:59:57 |只看作者 |坛友微信交流群
这道题我跑了一下程序,感觉是d:
data temp (index=(id));
input id$ amount;
cards;
  P     52   
  P     45   
  A    13   
  A    56   
  R     34   
  R     12   
  R     78   
  ;


Data first;
  Set temp;
By id;
  If first.id then output;
  data last;
  set temp;
  by id;
  if last.id then output;
Proc print;
run;
结果和sort一样,同样c:的翻译是按照自然排序也就是说给的数据本来就是有顺序的,运行后也是可以得到结果的。

使用道具

7
Tigflanker 发表于 2015-12-29 10:28:15 |只看作者 |坛友微信交流群
我要选的话,可能会被干扰到B项去,确实没太了解index的作用

使用道具

8
Errol1993 发表于 2016-7-8 09:41:14 |只看作者 |坛友微信交流群
就喜欢马 发表于 2015-5-23 14:02
SAS自带的变量first.变量和last.变量使用前提是data步中有by语句。而data步中用by语句的变量必须要在data步 ...
the data sets that are listed in the SET statement must be sorted by the values of the BY variable(s), or they must have an appropriate index.BASE书中的原文,也就是要用BY variable语句的话前提是之前对该variable进行了SORT步骤,或者在该VARIABLE本身就是一个索引。所以我做题时AB都想选过两天要去考了,,实在想求一个正确的答案呀。

使用道具

9
Errol1993 发表于 2016-7-8 09:41:36 |只看作者 |坛友微信交流群
就喜欢马 发表于 2015-5-23 14:02
SAS自带的变量first.变量和last.变量使用前提是data步中有by语句。而data步中用by语句的变量必须要在data步 ...
the data sets that are listed in the SET statement must be sorted by the values of the BY variable(s), or they must have an appropriate index.BASE书中的原文,也就是要用BY variable语句的话前提是之前对该variable进行了SORT步骤,或者在该VARIABLE本身就是一个索引。所以我做题时AB都想选过两天要去考了,,实在想求一个正确的答案呀。

使用道具

10
haosongs 发表于 2018-11-24 16:28:38 |只看作者 |坛友微信交流群
经试验正确答案是D

使用道具

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

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-25 08:04