Date: Wed, 12 Jun 2002 11:07:42 -0700
Reply-To: "Huang, Ya" <ya.huang@PFIZER.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Huang, Ya" <ya.huang@PFIZER.COM>
Subject: Re: Jump out from DOW loop?
Content-Type: text/plain; charset="iso-8859-1"
Paul,
I guess the key is "You still have to read each record".
I tried the following code which has a "leave" in there,
I was hoping that I can break the loop, but apparently,
the looping is still going on until it reach the last.id.
data xx;
do until(last.id);
set xx;
by id;
if val ne 0 then leave;
end;
run;
So, DOW is special.
Kind regards,
Ya Huang
-----Original Message-----
From: Dorfman, Paul [mailto:Paul.Dorfman@bcbsfl.com]
Sent: Wednesday, June 12, 2002 11:00 AM
To: 'Huang, Ya'; SAS-L@LISTSERV.UGA.EDU
Subject: RE: Jump out from DOW loop?
Ya,
You still have to read each record, but if you do not want the DOW to skip
processing it, you can code a conditional CONTINUE.
Kind regards,
====================
Paul M. Dorfman
Jacksonville, FL
====================
> -----Original Message-----
> From: Huang, Ya [mailto:ya.huang@pfizer.com]
> Sent: Wednesday, June 12, 2002 1:46 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Cc: Dorfman, Paul
> Subject: Jump out from DOW loop?
>
>
> Hi there,
>
> It seems to me that there is no way one can jump out
> the DOW loop, once it started:
>
> data xx;
> input id val;
> cards;
> 1 0
> 1 0
> 1 7
> 1 4
> 2 0
> 2 3
> 2 5
> ;
>
> data xx;
> true=0;
> do until(true);
> set xx;
> by id;
> if val ne 0 then true=1;
> end;
> run;
>
> options nocenter;
> proc print;
> run;
> --------------
> Obs true id val
>
> 1 1 1 7
> 2 1 1 4
> 3 1 2 3
> 4 1 2 5
>
> I expected to see:
>
> 1 1 1 7
> 2 1 2 3
>
> This is different from a regular loop. Can someone
> explain it to me? How about you, Paul?
>
> Kind regards,
>
> Ya Huang
>
>
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.
|