LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2003, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 5 Sep 2003 08:02:37 -0700
Reply-To:     "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Subject:      Re: Do ... Until
Comments: To: John Whittington <>
Content-Type: text/plain

Thanks for the pointer John - if it saves typing, then I'm 50% more likely to apply it!

Of course, GoTo or Link statements allow conditional exiting to specific points in the program, rather than just the end of the loop, as does Leave. I won't want to completely give up my old habits.

Paul Choate DDS Data Extraction (916) 654-2160

-----Original Message----- From: John Whittington [] Sent: Thursday, September 04, 2003 6:20 PM To: Choate, Paul@DDS; SAS-L@LISTSERV.UGA.EDU Subject: Re: Do ... Until

At 08:37 04/09/03 -0700, Choate, Paul@DDS wrote:

>Why not just explicitly exit the loop? > >data _null_; > str = '1432 5664 6987'; > > do c = '3244','5664','6756'; > flag1 = index(str, c) > 0; > put _all_; > if flag1 then goto exit; > end; > exit: >run;

Paul, that will certainly work - but, as others have said, it's probably better to use LEAVE (which was explicitly designed for this job) rather than using GOTO to jump to a label. Whilst I'm not specifically aware of any problems in SAS arising from jumping out of a DO loop with a GOTO, it feels more comfortable to use the tool designed for the job (and which, incidentally, saves several keystrokes and a 'line' of code!).

Kind Regards,


---------------------------------------------------------------- Dr John Whittington, Voice: +44 (0) 1296 730225 Mediscience Services Fax: +44 (0) 1296 738893 Twyford Manor, Twyford, E-mail: Buckingham MK18 4EL, UK ----------------------------------------------------------------

Back to: Top of message | Previous page | Main SAS-L page