I just recently encountered the goto statement in SAS. I've used a similar construct in other programming languages. Although such control can be very useful, they need to be used sparingly because it makes program logic difficult to follow.
Phil Specter from Berkeley wrote an Introduction to the SAS System which I think sums up the goto statement clearly:
"You can use the goto statement to have SAS process statements in some other part of your program, by providing a label followed by a colon before the statements you wish to jump to. Label names follow the same rules as variable names, but have a different name space. When a labeled statement is encountered in normal processing, it is ignored."
He provides a short example:
data two;
set one;
if x ^= . then goto out;
x = (y + z) / 2;
out: if x > 20 then output;
run;
Similarly, on a SAS Google Group thread, another example was provided:
data class;
input name $ 1-8 sex $ 11 age height weight;
select (name);
when ('Alice') do;
goto Alice;
end;
when ('Becka') do;
goto Becka;
end;
when ('Gail') do;
goto Gail;
end;
end;
Alice: x=4;
return;
Becka: x=5;
return;
Gail: x=6;
return;
datalines;
Alice F 13 56.5 84.0
Becka F 13 65.3 98.0
Gail F 14 64.3 90.0
run;
More resources on Goto: