How can I write a program that will look for "25" in column B below and stop at the second "25" for the same group in column A? I have been using the index feature to account for the double entries in column B but am at a loss on how to proceed in this case.
You will need to set up an indicator flag using a RETAIN statement. You would set the indicator to 0 (off) for the first row in A and set it to 1 (on) for the first occurrence of 25. If you find another 25, use the STOP command to terminate building the output data set.
Read about RETAIN and BY-Group processing in the reference manual to understand how these things work together.
Something like this should work (untested code):
IF first.a THEN flag=0;
IF INDEX(b,'25') GT 0 THEN DO;
IF flag=1 THEN STOP;
Doc already suggested code that will do what you asked, but do you really want to stop processing for all groups when two 25s are found? Or do you only want to not process any more of that group's records?
If it is the latter, I'd suggest the following:
if first.a then flag=0;
IF INDEX(b,'25') GT 0 THEN flag+1;
if flag lt 2 then output;