In reply to Sandi.

I don't now what 'sas egp' is, but you can use the DO WHILE or DO UNTIL statements to loop until a condition is met.