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 (February 2006, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 22 Feb 2006 09:44:30 -0500
Reply-To:   "SASsy :-)" <sas__l@HOTMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "SASsy :-)" <sas__l@HOTMAIL.COM>
Subject:   Re: non-consecutive do loop
Content-Type:   text/plain; charset=ISO-8859-1

Yes, or if you want to skip based on some calculations or whatever, the "continue" statement can come in handy:

data _null_; do i=1 to 8; if 3<i<6 then continue; put i=; /* do your stuff here */ /* "continue" brings you down here*/ end; run;

i=1 i=2 i=3 i=6 i=7 i=8

On Wed, 22 Feb 2006 09:19:32 -0500, Droogendyk, Harry <harry.droogendyk@RBC.COM> wrote:

>8 >9 >10 data _null_; >11 do i = 1 to 3, 6 to 8; >12 put i=; >13 end; >14 run; > >i=1 >i=2 >i=3 >i=6 >i=7 >i=8 > >-----Original Message----- >From: >[]On Behalf Of Eric B >Sent: Wednesday, February 22, 2006 9:12 AM >To: >Subject: non-consecutive do loop > > >hi all, >I'm interested in doing a non-consecutive do loop, meaning I would like >this code: > >do i = 1 to 12; > ... >end; > >do i = 21 to 32; > ... >end; > >to be a little more compact, to say something like this: > >do i = (1 to 12) and (21 to 32) > ... >end; > >any ideas ? >Thanks >_______________________________________________________________________ > >This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. >Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. >If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately. > >Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent. >Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné (s) est interdite. >Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser immédiatement, par retour de courrier électronique ou par un autre moyen.

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