You can use an MD5 checksum, generated by the Blob MD5() function to generate a hash of the values in a column and then compare checksums across columns.
You can use an associative array to check for duplicate md5 checksums as they are generated to avoid having to compare every checksum with every other checksum yourself.
dt = New Table( "Some Duplicate Columns",
Add Rows( 1000 ),
New Column( "Column 1", Numeric, "Continuous", Format( "Best", 12 ), Formula( Random Normal() ) ),
New Column( "Copy of Column 1", Numeric, "Continuous", Format( "Best", 12 ), Formula( :Column 1 ) ),
New Column( "Not a copy of Column 1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula( If( Row() == 1, 1, :Column 1 ) )
),
New Column( "Character copy of Column 1", Character, "Nominal", Formula( Char( :Column 1 ) ) ),
New Column( "Character copy of Copy of Column 1",
Character,
"Nominal",
Formula( Char( :Copy of Column 1 ) ),
)
);
//get values into matrix (numeric columns) or list (character columns)
c1 = :column 1 << get values;
c2 = :Copy of Column 1 << get values;
//avoid having to check column data types when converting the values to blob
//by converting matrix or list to character
//
//if you're not lazy you could use the Matrix to Blob() function for numeric columns
//and the Char to Blob() function for character columns
char_c1 = Char( c1 );
char_c2 = Char( c2 );
c1_md5 = Blob MD5( Char To Blob( char_c1 ) );
c2_md5 = Blob MD5( Char To Blob( char_c2 ) );
Show( c1_md5 == c2_md5 );
//check the whole data table using hex version of md5 as keys of associative array
aa = Associative Array();
For( i = 1, i <= N Col( dt ), i++,
md5 = Hex( Blob MD5( Char To Blob( Char( Column( dt, i ) << get values ) ) ) );
//check to see if the associate array already has a key named with this md5
If( aa << Contains( md5 ),
//aa does contain md5
Print( aa[md5] || " is a duplicate of " || (Column( dt, i ) << get name) ),
//aa does not contain md5
//store a key named with this md5 with a value of the column name
aa[md5] = Column( dt, i ) << get name;
);
);
-Jeff