03-25-2013 10:20 PM
Hi - I am somewhat new to SAS, and am trying to determine the best course of action to accomplish my goal. I have a data set full of records, and I want to be able to pull one record out and compare it to every other record in the data set across each variable. Then, I'd like to be able to aggregate all the differences in order to find the most similar overall record(s).
For example, in the data set below, if I choose record A as the base record, I want to be able to compare record A to records B-V across every variable. Afterwards, I want to be able to say "Records L, R, and V are the most similar overall records to record A". I'm assuming this will have to be done using a macro to compare COL1 of record A to COL1 of record B, measuring & saving the difference, and then moving onto comparing record A to record C. But I was hoping there may be a more streamlined way to accomplish this?
Please let me know any help if possible!!! Thanks!
DATA test ;
infile datalines delimiter=",";
LENGTH col1 $1.;
input COL1 COL2 COL3 COL4 COL5 COL6;