|
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
|