|
|
Re: Questions to Dorfman's DO UNTIL loop #4
On Thu, 21 Jun 2007 14:02:54 +0000, Ian Whitlock <iw1junk@COMCAST.NET>
wrote:
>Summary: The implied loop of the DATA step is driven by input.
>#iw-value=1
>
>Robert Bardos <bardos2@ANSYS.CH> considered:
>
>> 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 ;
>
>and wrote:
>
>> 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?
>
>The DO-loop runs "forever" because 1 is not 2 just like 0 is false. So
>what does SAS do when asked to read an observation that it isn't there? It
>stops. Where? On the line requesting the read that cannot be fulfilled.
>
>Perhaps
>
> data _null_ ;
> put 'before set iteration' _n_ 2.;
> do until (1=2);
> put "top of DO-loop" ;
> set sashelp.class(obs=3) end=eod;
> put "bottom of DO-loop" ;
> end;
> put 'after set iteration' _n_ 2.;
> run ;
>
>would be more enlightening.
>
>I find it puzzling that one can become an expert SAS programmer without
>knowing when, why, and where a DATA step stops processing. I suppose it
>must be a tribute to the naturalness of the language.
>
>Ian Whitlock
The above is understood, but I could use expert insight on why
adding an end= option to a second set makes it *read* two obs.
instead of one:
624 data _null_;
625 put 'before set1 iteration' _n_ 2.;
626 do until (eod);
627 set sashelp.class end=eod;
628 end;
629 put 'after set1 iteration' _n_ 2.;
630 set sashelp.shoes; *end=finito;
631 put 'after set2 iteration' _n_ 2.;
632 run;
before set1 iteration 1
after set1 iteration 1
after set2 iteration 1
before set1 iteration 2
NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: There were 1 observations read from the data set SASHELP.SHOES.
include the second end= and observe that
NOTE: There were 2 observations read from the data set SASHELP.SHOES.
Can't get it output, tho' ? :) I'm lost...
Thanks, Arild
|
|
0
|
|
|
|
Reply
|
sko (123)
|
6/21/2007 2:58:30 PM |
|
|
0 Replies
20 Views
(page loaded in 0.062 seconds)
Similiar Articles: Question about the A20 line - comp.lang.asm.x86We just wait (busy wait/loop) until these memory locations are no longer aliased. ... comp.lang.asm.x86 Sent: Saturday, December 31, 2005 4:23 PM Subject: Re: Question ... stdout redirected to a process's own stdin - comp.unix.programmer ...however: ~/prog/c$ ./loop adder ....hangs until I press control-C. ... stdout, stderr and stdin to/from ... questions tagged ... STDOUT/STDERR on Win32 Re: capture child ... migrating mainframe z/VM Rexx to linux ooRexx - comp.lang.rexx ...... Of course, if your intention is just to loop through the lines, you can >do it inside that "Do until" Steve, Here's ... Quick Question re VMware - comp.os.cpm Installing ... sum of series in matlab - comp.soft-sys.matlabIn general, asking your question ON THE NEWSGROUP is sufficient to ... would write your sums numerically using a WHILE loop; iterate until the term that you're adding to ... xlsread issues - comp.soft-sys.matlab... Post Question ... access to the macro (easy to do with the Personal Workbook if you're ... WS.Activate; % Loop over the cells until a blank one ... Slow string search/fast binary search - comp.lang.asm.x86 ...... Post Question ... at best in 6+4.5*n cycles, so that's 6+4.5*15 = 74 clocks. Your binary search loop ... rep lods/movs/stos is not a win until you ... Printing from field 14 to end of record - comp.lang.awkFrom that point until the end of the record, I'd ... can simply print from fields 15 to NF in a loop. ... sub(/^[[:space:]]*([^[:space:]]*[[:space:]]*){4}/,"")' > c f g You're ... Allocatable versus automatic arrays - comp.lang.fortran... question ... 4. When you do ... re immediately going to reclaim it as the above code does, there's absolutely nothing to be gained by deallocating anything until the loop ... duplicating record with children - comp.databases.filemaker ...Then how do I loop through the child ... the script above ensures that you're ... Well, I'll do the ommitting; I'm just concerned about the question above (how to go to ... imported file name - comp.databases.filemakerI can't believe that we're at version 7.0 of ... it with filemakers impaired import function(s). Loop until ... end import script > > > > the question is: how do I command the ... 067-2007: DO Which? Loop, UNTIL, or WHILE? A Review of DATA Step ...Do Which? Loop, Until or While? A Review ... [3] Paul M. Dorfman. The magnificent Do. In ... to missing, DOW-loop: until(last.var). [5] Ian Whitlock. Re: SAS novice question. Question on Do-Whitlock (DOW) loop. - sas - Mofeel GroupsSecond: I would question the outer loop in DATA do_Whitlock_last; do until ... Subject: Re: Question on Do-Whitlock (DOW) loop. ... pondering Paul Dorfman & Ian's "Do Loop ... 7/30/2012 7:14:23 PM
|
|
|
|
|
|
|
|
|