Date: Fri, 21 Dec 2001 15:16:18 -0500
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: SAS Versions & Do Loops
Content-Type: text/plain; charset=iso-8859-1
> I have been lurking for a while and I see many appends about
> SAS V8, 8.2 and various 6.? I never see anything about V7.?
Rick,
It was a transitional version, kind of a beta for 8. I think we no longer
need to occupy the memory cell with this stuff.
> Was there ever any? Was it so bad that no one bothered to put it on?
The entire significance of 7 was that most of versus-V6 add-ons we now have
in 8 arrived in 7. But bug-wise, yeah, it was quite raw.
> Also, how do I break out of an iterative Do loop without
> setting the index to at or past the upper bound?
I do not remember where and when I saw the 'method' you describe the first
time, but I do remember that I was stunned by such an superfluous ingenuity.
It is a funny maladroit thing looking something like this:
do x=1 to 9 ;
<code>
if <condition> then x = 10 ;
<more code>
end ;
If the loop is to be quit from the middle as above, it will not work, for
the index value is not tested before the bottom of the loop is reached. But
if it is to be left at the bottom, then the IF is unnecessary, because the
condition can always be specified within an UNTIL clause:
do x=1 to 9 until (<condition>) ;
<code>
<more code>
end ;
Now if it is really necessary to quit from between <code> and <more code>,
the only ways to achieve the goal are GOTO or LEAVE (same GOTO in disguise).
do x=1 to 9 ;
<code>
if <condition> then Leave ;
<more code>
end ;
GOTO is the only sensible way to transfer control outside an outer loop in
the case loops are nested:
do ...... ;
<...more DOs...>
do x=1 to 9 ;
<code>
if <condition> then GOTO exit ;
<more code>
end ;
<...more ENDs...>
end ;
Exit:
Finally, there is the verb CONTINUE that transfers control immediately to
the bottom (not past the bottom of) the loop. A propos, all this goodness
had already existed in 6, so 7 and 8 have added nothing in this respect.
Seasonal greetings and salutations to all!
Kind regards,
=================
Paul M. Dorfman
Jacksonville, FL
=================
>
> Thanks
> Rick Bargar
> Columbia House Company
>
>
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.