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
In-Reply-To: <201005131605.o4DAl7Us024558@malibu.cc.uga.edu>
Content-Type: text/plain; charset="iso-8859-1"
Søren,
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.
Toby Dunn
"Don't bail. The best gold is at the bottom of barrels of crap."
Randy Pausch
"Be prepared. Luck is where preparation meets opportunity."
Randy Pausch
> 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
> http://pplab.snu.ac.kr/courses/adv_pl05/papers/p261-knuth.pdf
> (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
> [57] 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!
> Søren
_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2 |