Date: Thu, 13 May 2010 16:11:10 +0000
Reply-To: toby dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby dunn <tobydunn@HOTMAIL.COM>
Subject: Re: Alternative for "goto" in do loop
Content-Type: text/plain; charset="iso-8859-1"
Yes in general GOTO's are never needed. Proper loop construction, haveing no more than 3 levels of nesting, using proper branching, and in SAS coding the proper exit condtion at the beggining of the loop. SAS does have Leave and Continue statements. These aren't bad so long as the level of nesting and Looping is relatively simple. Th more omplex the Do-Loop the less one wants to use these as they just add unneeded code complexity.
"Don't bail. The best gold is at the bottom of barrels of crap."
"Be prepared. Luck is where preparation meets opportunity."
> Date: Thu, 13 May 2010 12:05:57 -0400
> From: s.lassen@POST.TELE.DK
> Subject: Re: Alternative for "goto" in do loop
> To: SAS-L@LISTSERV.UGA.EDU
> Perusing Knuths execellent paper
> (Thank you, Michael!), I stumbled upon this little gem:
> "Of course, event indicators are not the only decent alternatives to go to
> statements that have been proposed. Many authors have suggested language
> features which provide roughly equivalent facilities, but which are
> expressed in terms of exit, jumpout, break, or leave statements. Kosaraju
>  has proved that such statements are sufficient to express all programs
> without go to's and without any extra computation, but only if an exit from
> arbitrarily many levels of control is permitted."
> Which seems to vindicate my personal GOTO policy quite adequately, namely
> that GOTOs can be used instead of LEAVE when you need to break out of several
> levels of nested loops, and (in SAS) STOP or DELETE(/RETURN) is too drastic.
> Thanks to you all for an entertaining and enlightening discussion!
Hotmail is redefining busy with tools for the New Busy. Get more from your inbox.