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 (January 2011, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 11 Jan 2011 20:08:42 +0000
Reply-To:   "Fehd, Ronald J. (CDC/OCOO/ITSO)" <rjf2@CDC.GOV>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Fehd, Ronald J. (CDC/OCOO/ITSO)" <rjf2@CDC.GOV>
Subject:   Re: Identify ties for values of variables
In-Reply-To:   <201101111940.p0BILijZ030086@wasabi.cc.uga.edu>
Content-Type:   text/plain; charset="us-ascii"

From: Shukla Kshirsagar Sent: Tuesday, January 11, 2011 2:40 PM Subject: Identify ties for values of variables

I have 8 brands in a dataset, with possible values of 0-9 for each of them.

I want to write macro code, where I can look for ties in the values of the brands, and create a flag. e.g if brand1=brand2 or brand1=3 or......brand1=brand8 or brand2=brand3........ then flag=1

b1 b2 b3 b4 b5 b6 b7 b8 flag 2 0 5 6 3 0 0 0 0 3 0 4 0 0 3 2 0 1

Thanks for your help, Shukla

The easiest answer is to take working code and rewrite it for your case

See SAS programs of Donald Knuth's algorithms for sorting and searching on SAS community wiki:

http://www.sascommunity.org/wiki/Category:Knuth

The easiest and most obvious for your purpose is the Shell Sort

Ron Fehd the Knuth maven


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