Hi JMP Community,
I have a data table (dt1) with many columns and would like to rename them. They are coded with strange names. But, I have another data table (dt2) with only two columns :Name and :Code. Each row in dt2 has the meaningful name that is associated with the code.
I know how to do this with for loops, but I'm trying to learn something new and hoping to do it through an Associative Array. Something similar to what's in this thread here. I thought I could do something like this:
Names Default To Here( 1 );
dt = Data Table( "dt1" );
dtnames = Data Table( "dt2" );
aa_name_code = Associative Array(
Column( dtnames, "Name" ) << Get Values,
Column( dtnames, "Code" ) << Get Values
);
aavalues = aa_name_code << Get Values;
aakeys = aa_name_code << Get Keys;
Eval( Eval Expr( Column(dt,Expr( aavalues )))) << Set Name( Expr( aakeys ) ) ) );
But, unfortunately, this doesn't work. It's not behaving how I thought the associative arrays behaved.
Again, I want to try and learn something new and get better with a new JSL command, which is why I want to work through the Associative Array. If it's not possible I'll do it the brute-force For-Loop way.
Thanks for any thoughts and feedback on this!,
DS