hi
I might not have fully understand the task, but there are some handy functions that will help you with this.
The example below uses the LARGEST function to the return the largest as well as the second largest values.
Using the WHICHN function will return the position of the value within the array i this matter in any way.
data test1;
infile cards dlm=',';
input ID MonthYear Event1_date1 Event1_date2 FEvent_date1;
array xevents{*} Event1_date1 Event1_date2 FEvent_date1;
nEvents = n(of xevents{*});
largestEvent = largest(1, of xevents{*});
largestEvent2 = largest(2, of xevents{*});
iLargestEvent = WHICHN(largestEvent, OF xevents{*});
iLargestEvent2 = WHICHN(largestEvent2, OF xevents{*});
format event: fevent: largest: date9.;
cards;
1, 1, 3000, ,
1, 2, , ,
1, 3, 3060, , 3100
1, 4, , ,
2, 8, 2090, 3040,
2, 9, ,
2, 10, , , 3190
3, 1, 2935, 2945, 2965
3, 2, , ,
;
... View more