to sxlion
All three methods above can be used to sovle this problem. However,
the first and third one are not good for the large data set because of
the limitation of computer memory. So the second one is the best - using
POINT option for direct access.
Unlike any other databases, the record pointer (not exist but you can
imagine) in SAS can not move forward or backward freely with your
control. I am still struggling on this problem. Once I have the solution,
I will share it with you guys for sure. We might consider the following
piece of sas code:
data test_1;
set test;
by ID;
retain pointer .;
if first.id=1 then pointer=_N_;
if not last.id then do;
pointer=pointer+1;
.
.
.
.
do j=pointer to last_positon_within_ID;
set test(rename=(time=time_1) keep=time) POINT=j;
if time_1-time=10 then do something;
end;
.
.
.
run;