LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2007, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
Comments: To: sas-l@uga.edu
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;


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