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 2003, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 8 Sep 2003 11:41:55 +0100
Reply-To:   Roland <roland@RASHLEIGH-BERRY.FSNET.CO.UK>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Roland <roland@RASHLEIGH-BERRY.FSNET.CO.UK>
Organization:   Universe Monitors
Subject:   bubble sort with SAS

I've been reading up on and trying to understand the "bootstrap" technique as applied to analysis of clinical data and it struck me that with random sampling with maybe millions of iterations it could be faster to do all the analysis you can within the same data step and never leave it. Getting a median value and the 95% limits is a problem unless you can sort your values so I wrote a simple bubble sort to do this. I wonder if I am going in the right direction with this. I am trying to make the process as efficient as possible and trying to limit the number of observations being passed out of a data step and on to other procedures. However, I don't want to compromise and analysis that must be done on the data. Perhaps some kind statistician who works on analysis of clinical trials and has a need for this sort of coded techniques to be developed could point me in the right direction.

Here is the bubble sort for you to play around with:

data _null_; array _val {20} 8 (20*0);

*- assign a random value to all the cells and display -; do i=1 to 20; _val(i)=floor(ranuni(9)*500); put _val(i)=; end;

*- bubble sort -; max=dim(_val); swapdone=1; do while(max > 1 and swapdone); swapdone=0; do i=1 to (max-1); if _val(i)>_val(i+1) then do; store=_val(i+1); _val(i+1)=_val(i); _val(i)=store; swapdone=1; end; end; max=max-1; end;

*- display the final sorted order -; do i=1 to 20; put _val(i)=; end; run;

-- "Today's mighty oak is just yesterday's nut, that held its ground." - David Icke


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