LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (November 2011, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 5 Nov 2011 19:36:00 -0500
Reply-To:     Joe Matise <snoopy369@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Joe Matise <snoopy369@GMAIL.COM>
Subject:      Re: Lost Card Question (please see this one)
In-Reply-To:  <4B0E85351F784504BB17A046FB43177E@D1871RB1>
Content-Type: text/plain; charset=ISO-8859-1

Ahhh, that makes a lot more sense now. The 3rd data step is going through the loop only once (as I expected, per DO UNTIL), and then ends the iteration of the data step loop; but since it hasn't attempted to read beyond EOF it does not terminate the data step loop. Thus the second data step loop iteration is entered, and it (as normal) terminates normally upon attempting to read past EOF without the 'LOST CARD' message. The fourth data step is trying to read two cards per data step loop iteration, which is thus failing to find the second card and getting 'LOST CARD'.

-Joe

On Sat, Nov 5, 2011 at 2:52 PM, Nat Wooding <nathani@verizon.net> wrote: > Joe et al. > > For grins, I tried using the data step debugger for the first time in quite > a while. I opened two SAS sessions and was able to execute the two sets of > code in parallel. Doing this, you can watch the individual statements as > they are executed. > > For those who have not used the debugger, use the option on the Data > statement as in the code below. > > > *step 4; > data _null_ / debug; > infile "c:\have.dat" end=_end; > do i=1,2; > input x; > end; > run; > > For reading on the debugger, Dave Riba did a SUGI 25 paper on the topic. The > link is > > http://www2.sas.com/proceedings/sugi25/25/btu/25p052.pdf > > Nat Wooding > > -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Joe > Matise > Sent: Saturday, November 05, 2011 1:20 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: Lost Card Question (please see this one) > > I'm actually a bit curious about this, as my experience matches Tom's > from the other thread (it does actually enter the loop and execute at > least one line) on the DO UNTIL... > > -Joe > > On Fri, Nov 4, 2011 at 11:32 PM, Mark Miller <mdhmiller@gmail.com> wrote: >> Max, >> >> do until(_end) is tested at the END of the loop >> so the loop body is executed only once >> as _END has been set after first pass >> >> do 1,2 always tries to run the loop body 2 times >> >> ... Mark Miller >> >> On 11/4/2011 7:24 PM, bbser 2009 wrote: >>> >>> Hi there, >>> >>> After running the code below, there was no problem for step 3, but I got >>> the >>> lost card information from step 4. >>> I feel strange about this: >>> I assume in step 3 SAS entered into the do until block twice, >>> which in effect is similar as the step 4, >>> thus we should have got the lost card information from step 3 as well, >>> but we actually do not get this information. >>> >>> Could anyone please say anything about this? Thank you very much. >>> >>> Best regards, Max >>> (Maaxx) >>> >>> ========== >>> >>> data have; >>> x=1; >>> run; >>> >>> data _null_; >>> set have; >>> file "c:\have.dat"; >>> put x; >>> run; >>> >>> *step 3; >>> data _null_; >>> infile "c:\have.dat" end=_end; >>> do until(_end); >>> input x; >>> end; >>> run; >>> >>> *step 4; >>> data _null_; >>> infile "c:\have.dat" end=_end; >>> do i=1,2; >>> input x; >>> end; >>> run; >> > >


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