SPSS Modeler group by and select top n rows

458 Views Asked by At

I would like to know what is the proper way in SPSS to group data by specydic column and then find top n max values.

For example I have below columns:

x<-c(3,2,1,8,7,11,10,9,7,5,4)
y<-c("a","a","a", "b","b","c","c","c","c","c","c")
z<-c(2,2,2,1,1,3,3,3,3,3,3)

I want to select top max n values from column X for each group by column y

    x y 
1   3 a 
2   2 a 
3   1 a 
4   8 b 
5   7 b 
6  11 c 
7  10 c 3
8   9 c 3
9   7 c 3
10  5 c 3
11  4 c 3
0

There are 0 best solutions below