Date: Wed, 19 Sep 2007 01:40:04 -0000
Reply-To: yangsky66@GMAIL.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: yangsky66@GMAIL.COM
Organization: http://groups.google.com
Subject: Re: problem of insertion sorting algorithms
In-Reply-To: <2C6B65AAC3623140922DE580669C456A03B79FA7@LTA3VS001.ees.hhs.gov>
Content-Type: text/plain; charset="us-ascii"
your translation of line 5 to sas 'do while' is incorrect.
That is my confused point. I still couldn't figure out it by proc IML
even I read Knuth sorting by insertion. I understood the logic but I
could not get right answer.
proc iml;
A={5 2 4 6 1 3 };
do j=2 to 6;
key=A[j];
do i=j-1 to 1 by -1;
if key>=A[i] then return;
else A[i+1]=A[i];
end;
A[i+1]=key;
end;
print a;
quit;
|