全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
2873 10
2015-05-23
请问这个题要选哪个?为什么,谢谢

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

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




二维码

扫码加我 拉你入群

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

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

全部回复
2015-5-23 10:13:17
select A.
二维码

扫码加我 拉你入群

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

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

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步之前排序
二维码

扫码加我 拉你入群

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

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

2015-5-28 09:11:31
谢谢O(∩_∩)O~
二维码

扫码加我 拉你入群

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

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

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:的翻译是按照自然排序也就是说给的数据本来就是有顺序的,运行后也是可以得到结果的。
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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