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 (March 2004, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 9 Mar 2004 16:20:50 -0500
Reply-To:     "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>
Subject:      Re: Simple Arithmetic question..
Comments: cc: camherst@MISER.UMASS.EDU
Content-Type: text/plain; charset="us-ascii"

> From: Christopher Amherst [mailto:camherst@MISER.UMASS.EDU] > I have a bubblesort algorithm in a program.

... for a data step array, right?

> The data in question is in reverse order, so I can create a > reverse sort algorithm to replace the bubblesort.

you may wish to examine the ordinal function

> HOWEVER. > To do a reverse sort algorithm, in my DO loop, the end > counter is to represent the quotient. (ie. count/2) > > Does anyone know of a function or operator in SAS that can > perform a division operation and return the quotient sans the > remainder? > > (I'm use to having a DIV operator.. but can find no > documentation in SAS for such an operation and fear that I'd > have to do something akin to (Count - MOD(Count,2)/2 )

BubbleSort, iirc, is one of the slowest sort algorithms. but is redeemed by being just about the easiest to code and comprehend.

You may also wish to read up on some other algorithms.

Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov

check our most excellent archives: http://www.listserv.uga.edu/archives/sas-l.html search for: ordinal substring search: [X] subject contains: author's address: since: Jan 2000 until:

for other sorting algorithms: search for: substring search: [ ] subject contains: Knuth author's address: since: Jan 2000 until:

for Truly Blinding Speed: search for: hashing substring search: [ ] subject contains: author's address: dorfman since: Jan 2000 until:


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