Date: Wed, 24 Jul 2002 14:13:56 -0400
Reply-To: "Dorfman, Paul" <Paul.Dorfman@BCBSFL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Dorfman, Paul" <Paul.Dorfman@BCBSFL.COM>
Subject: Re: GOTO and LINK vs IF THEN DO
Content-Type: text/plain; charset=iso-8859-1
> From: Peter Flom [mailto:flom@NDRI.ORG]
> I was looking into GOTO and LINK, and trying to figure out
> what they do that couldn't be done with a set of IF THEN do-groups.
You are setting the question backwards. Virtually any programming sentence
can be constructed using nothing but IF-THEN and GOTO, including equivalents
of ELSE and SELECT (selection), DO-loop (repetition), LEAVE (GOTO loop
exit), CONTINUE/RETURN (GOTO loop's bottom), DELETE (GOTO loop's top), and
LINK (subroutine call: GOTO block, execute block, GOTO next instruction).
So, if the question were instead "In terms of execution, what can the
prepackaged selection, repetition, and branching constructs do that IF-THEN
and GOTO cannot?", the answer would be "Nothing". However, in terms of
programming, they can do a lot (see below)!
> Is this a redundancy, or are there separate functionalities to these?
Of course these are redundancies, but they are useful redundancies. The more
redundant the language, the richer it is and the easier it is to use when it
is necessary to express a human computing request in non-machine terms.
Assembler is redundant to the machine language, 3GLs are redundant next to
Assembler, SQL is redundant next to 3GLs, etc., but each next stage has the
increasing ability of allowing one to program in logical terms, leaving
procedural details to compilers, optimizers, supervisors, etc. Analogously,
ELSE, SELECT, LINK, DO-loops and such help organize a program with a
structure discernable much better than if implemented with bare IF-THEN and
Which of course does not mean that there is no work for GOTO left. For
instance, there is no simpler and logically clearer way of exiting a bunch
of deeply nested DO-loops, or getting out of a DO-loop from a SELECT nested
within the loop (in which case LEAVE will not work), or returning
recursively to the top of a LINK module (the number of times a subroutine
can LINK to itself is limited I think to 10).
Paul M. Dorfman
> Peter L. Flom, PhD
> Assistant Director, Statistics and Data Analysis Core
> Center for Drug Use and HIV Research
> National Development and Research Institutes
> 71 W. 23rd St
> New York, NY 10010
> (212) 845-4485 (voice)
> (917) 438-0894 (fax)
Blue Cross Blue Shield of Florida, Inc., and its subsidiary and
affiliate companies are not responsible for errors or omissions in this e-mail message. Any personal comments made in this e-mail do not reflect the views of Blue Cross Blue Shield of Florida, Inc.