Here is the basic structure of my code:
DATA SUSBUILD0;
SET SUSBUILD0;
LENGTH COUNTER 2;
COUNTER eq 1;
LAGPID eq LAG(PID);
LAGBENTYPE eq LAG(BEN_TYPE_CODE);
IF _N_ GT 1 THEN
DO;
IF (LAGPID eq PID AND
LAGBENTYPE eq BEN_TYPE_CODE)
THEN
COUNTER eq COUNTER + 1;
END;
RETURN;
Looks like this do loop can be only visited once and stop or somehow as it loops through, it always carries the old memory that COUNTER eq 1, so COUNTER becomes 1 + 1 eq 2. As a matter of fact, none of my output records have COUNTER carry values either than 1 or 2.
I have a feeling that there must be something simple I have missed in my do loop. Sorry for I asked such a dump question.