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 (January 2004, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 29 Jan 2004 12:12:18 -0700
Reply-To:     Jack Hamilton <JackHamilton@FIRSTHEALTH.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jack Hamilton <JackHamilton@FIRSTHEALTH.COM>
Subject:      Re: Leaving Do loop in %Do
Comments: To: datametric@CLUB-INTERNET.FR
Content-Type: text/plain; charset=iso-8859-1

<datametric@CLUB-INTERNET.FR> wrote:

>Your %do statement is open when you do this. Be careful with the nested loops.

Really ?

could you explain this ?

Under what circumstances will the code below cause a problem? The documentation warns against branching into the middle of a loop, but not against branching out.

-- JackHamilton@FirstHealth.com Manager, Technical Development Metrics Department, First Health West Sacramento, California USA

>>> "SUBSCRIBE SAS-L Stephane" <datametric@CLUB-INTERNET.FR> 01/29/2004 9:28 AM >>> Your %do statement is open when you do this. Be careful with the nested loops.

Stéphane.

----Message d'origine---- >Date: Wed, 28 Jan 2004 23:54:39 -0700 >De: Jack Hamilton <JackHamilton@FIRSTHEALTH.COM> >Sujet: Re: Leaving Do loop in %Do >A: SAS-L@LISTSERV.UGA.EDU > >Use a %GOTO to a label immediately after the loop > >===== >%macro x; > %do i = 1 %to 12; > %if &i = 4 %then %goto exitloop; > &i > %end; > %exitloop: >%mend x; > >%put %x; >===== > >prints > > 1 2 3 > >Gotos can lead to trouble, and so their use should be restricted to >cases like this one. > > > > >-- >JackHamilton@FirstHealth.com >Manager, Technical Development >Metrics Department, First Health >West Sacramento, California USA > >>>> "taran gujral" <taran_jit@YAHOO.COM> 01/28/2004 8:34 PM >>> >hello folks , > >i wanted to know how we could leave a %do loop as >we leave Do loop with a leave . > >like > >Do i =1 to 5; > >if i = 4 then leave; >end; > >what can i use if i have %do loop > >thanks > > >--------------------------------- >Chat instantly with your online friends? >Get the FREE Yahoo!Messenger > >


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