```Date: Thu, 21 Jun 2007 09:33:39 -0400 Reply-To: "Fehd, Ronald J. (CDC/CCHIS/NCPHI)" Sender: "SAS(r) Discussion" From: "Fehd, Ronald J. (CDC/CCHIS/NCPHI)" Subject: Re: Questions to Dorfman's DO UNTIL loop In-Reply-To: Content-Type: text/plain; charset=us-ascii > From: Robert Bardos > Paul Dorfman's very interesting post and solution to the > recent 'two-variable deduplication problem' thread had me > stumped and I have to admit that I have some difficulty > understanding why his 'do until (0)' technique works the way it does. I reference Paul Dorman's Most Excellent Paper: The Magificent Do http://www.devenezia.com/papers/other-authors/sesug-2002/TheMagnificentD O.pdf in my Paper sgf2007.067: DO Which? Loop, UNTIL, or WHILE? A Review of DATA Step and Macro Algorithms http://www2.sas.com/proceedings/forum2007/067-2007.pdf Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov > I stripped the data step down to this (while choosing 'do > until (1=2)' for clarity.) > > data _null_ ; > put 'before set iteration' _n_ 2.; > do until (1=2); > set sashelp.class(obs=3) end=eod; > end; > put 'after set iteration' _n_ 2.; > run ; > > The log shows: > > before set iteration 1 > > Now contrast this with > > data _null_ ; > put 'before set iteration' _n_ 2.; > do until (eod); > set sashelp.class(obs=3) end=eod; > end; > put 'after set iteration' _n_ 2.; > run ; > > Where the log shows: > > before set iteration 1 > after set iteration 1 > before set iteration 2 > > The surprising (to me) thing here being the fact that > executing the first piece of code neither of the last two put > statements that the second piece of code displayed showed up. > > For the first piece of code I had expected the three log > lines as displayed by the second piece of code *plus* a 'data > step stopped due to looping' message. > > I guess what surprises me most is the 'after' message not showing up. > > Anybody care to explain what exactly happens in the first data step? > > Many thanks in advance (and many thanks to everybody > answering my 'dying IT skills URL link missing' question) > > Robert Bardos > Ansys AG, Zurich, Switzerland ```

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