data raw;
input a b c;
datalines;
4 4 1
2 3 1
3 6 2
4 5 2
1 2 1
5 5 3
4 7 3
;
data out;
do _n_=1 by 1 until(last.c);
set raw;
by c notsorted;
first_c=first.c;
last_c=last.c;
output;
end;
run;
proc print;
run;
请问notsorted选项的作用不是进行分组不排序吗?
SAS 系统 2012年01月13日 星期五 下午01时49分19秒 1
Obs a b c first_c last_c
1 4 4 1 1 0
2 2 3 1 0 1
3 3 6 2 1 0
4 4 5 2 0 1
5 1 2 1 1 1
6 5 5 3 1 0
7 4 7 3 0 1
为什么第2条记录的last_c值为1,而第5条记录的first_c值为1呢?不是进行分组吗?C的值都为1,应该是一组啊。请问为什么?