Suggest you share info about your actual data, ideally in a DATA step format, using DATALINES for an instream data example, and show an INPUT statement to read this data -- this info will help us understand what your working with.
Fundamentally, the DATA STEP facilities to use with a BY statement, such as:
*sort your data using PROC SORT. ;
PROC SORT....;
BY ;
RUN;
* now analyze patterns of mydate values for ;
* an individual, using the DATA step. ;
DATA ...;
SET ;
BY varname1 varname2;
IF FIRST.varname2 THEN DO;
* Use RETAIN to keep track of first date across ;
* DATA step executions. ;
RETAIN F_mydate 0;
F_mydate = mydate;
END;
* code to compare mydate to F_mydate;
RUN;
Scott Barry
SBBWorks, Inc.