Date: Fri, 11 Jan 2008 17:01:18 -0500
Reply-To: SUBSCRIBE SAS-L Dan <deniseyu001@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: SUBSCRIBE SAS-L Dan <deniseyu001@GMAIL.COM>
Subject: Question on Do-Whitlock (DOW) loop.
Hi. SASLers:
Could anyone help on the topic:
The original correct code is:
Proc Sort data = SAShelp.Class
out = Class;
by Sex Name;
run;
proc print ; run;
DATA do_Whitlock_last;
do until(EndoFile);
do until(last.Sex);
set Class end = EndoFile;
by Sex;
end;
output;
put Sex= Name=;
end;
stop; run;
The output is
Obs Name Sex Age Height Weight
1 Mary F 15 66.5 112
2 William M 15 66.5 112
I was trying to modify the code using WHILE instesd of UNTIL and my code is
below. It is in a dead loop. Could anyone out there point out where my
misunderstandings are? Thanks a lot.
DATA do_Whitlock_last_Modify;
do until (EndFile);
do while (not LastSex);
set Class end = EndoFile;
by Sex;
LastSex=last.sex ;
EndFile=EndoFile ;
end;
output;
put Sex= Name= LastSex= EndFile=;
end;
put 'Test is running'
stop; run;