Displaying 1 result from an estimated 1 matches for "abclist".
Did you mean:
ab_list
2006 Jan 10
1
Find last row (observation) for each combination of variables
...un;
proc sort data=DF NODUPKEY;
by A B C;
run;
I tried using "aggregate" to find the maximum TS for each combination of A/B/C, but it's slow.
I also tried "by" but it's also slow.
My current (faster) solution is:
DF$abc<-paste(DF$A,DF$B,DF$C,sep="")
abclist<-unique(DF$ABC)
numtest<-length(abclist)
maxTS<-rep(0,numtest)
for(i in 1:numtest){
maxTS[i]<-max(DF$TS[DF$abc==abclist[i]],na.rm=TRUE)
}
maxTSdf<-data.frame(device=I(abc),maxTS=maxTS )
DF<-merge(DF,maxTSdf,by="abc",all.x=TRUE)
DF<-Df[DF$TS==DF$maxTS,,drop=TR...