Date: Thu, 14 Oct 2004 07:33:11 -0400
Reply-To: "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM>
Subject: Re: SAS datastep-looping problem
On Thu, 14 Oct 2004 01:49:12 -0700, Jesper Sahner
<jespersahner@HOTMAIL.COM> wrote:
>Hi!
>
>Just a little teaser :-)
>
>Try the following:
>
>data test;
>do until (last);
> set sashelp.prdsale end=last;
>end;
>output;
>run;
>
>No problem. Now try this:
>
>data test2;
>retain first 1;
>if first then do;
> first=0;
> do until (last);
> set sashelp.prdsale end=last;
> end;
>end;
>output;
>run;
>
>This doesn't work. What is the EXACT explanation?
Hi, Jesper,
I recommend Ian Whitlock's paper on SAS Supervisor (one version is found
at http://www.dc-sug.org/super3.pdf). In one place in the paper, he asks
an rhetorical question:
Perhaps the first question to ask is, "What stops the [data step] looping
process and where does it stop?"
Answers found in the paper. :-)
Cheers,
Chang
|