Hi, I need to flag the last AVALC = 'Y' record prior to this AVALC='N' record. For example,
for the following dataset, I need to flag the third A record and second B subjid . Thank you so much
data have;
input usubjid $ ADY AVALC $;
datalines;
A 15 N
A 36 N
A 57 Y
A 60 N
A 61 Y
A 62 N
A 63 Y
A 64 Y
A 65 Y
B 15 Y
B 36 Y
B 57 N
B 58 N
B 60 Y
;
run;