```Date: Fri, 26 May 2000 12:19:59 -0400 Reply-To: Richard.Graham@INTELLICISIONS.COM Sender: "SAS(r) Discussion" From: "Richard W. Graham" Subject: Re: problem sorting array Comments: To: bolvandubina@NETSCAPE.NET Content-type: text/plain; charset=us-ascii By my calculation, 1000 * 1000 = 1,000,000 iterations, which for your system takes .71 seconds. However, when increasing the dim size to 100,000, then 100,000 * 100,000 = 10,000,000,000. Now 10,000,000,000 / 1,000,000 is 10,000. Thus 10,000 *.71=7100 cpu seconds equating to 118.33 minutes or 1 hour and 58 minutes. So stopping the process after 710 seconds gets you only 1,000/10,000 or one-tenth of the way through the dimension. Richard bolvandubina@NETSCAPE.NET@LISTSERV.UGA.EDU> on 05/26/2000 11:35:58 AM Please respond to bolvandubina@NETSCAPE.NET Sent by: "SAS(r) Discussion" To: SAS-L@LISTSERV.UGA.EDU cc: (bcc: Richard Graham/Tech/Intellicisions) Subject: problem sorting array Hello sas-l: I run SAS V8 on MVS. I needed to sort an array in a datastep and got code from our lead SAS expert programmer she said was supposed to be most efficient. And indeed when I tried it on an array with 1000 buckets it worked very fast (.71 cpu sec). But when I try it on a real array (100000) the program seems to be looping. it seems that theoretically it should have finished in 71 cpu sec, right? But I had to cancel the job after it had run for over 710 cpu sec. If the code doesn't loop with 1000 buckets how can it loop with 100000? And plus must not both DO-loops below must stop when both I and J reach dim(a)? data _null_; array a(1000) _temporary_; do i=1 to dim(a); a(i) = ranuni(12345); end; do j=1 to dim(a); do i=2 to dim(a); if a(i-1) > a(i) then do; t = a(i-1); a(i-1) = a(i); a(i) = t; end; end; end; run; I appreciate any clarification of what I must be missing here. TIA, Bolvan ---------- Get your own FREE, personal Netscape Webmail account today at http://home.netscape.com/webmail/ ```

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