I'm creating a list of potential column names that may be encountered in one of many data tables that are worked with, creating an actual list of columns found in the opened data table, and then trying to create a list of of values corresponding to the actual column list. However, when I run the following code, it is grabbing the value from the first column in the list for all columns listed that I cycle through. This code is resulting in a list = {13.975, 13.975} instead of {13.975, 105}. I've tried various iterations for this but can't get the correct values. Any suggestions would be greatly appreciated.
Clear Log();
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
dt_col_name_list = dt << Get Column Names( String );
dtsum = dt << Summary(
Mean( Eval( dt_col_name_list ) ),
Freq( "None" ),
Weight( "None" ),
statistics column name format( "column" )
);
// Potential column name list
pot_col_list = {"age", "mass", "height", "length" };
dtsum_col_name_list = dtsum << Get Column Names( String );
show(dtsum_col_name_list);
// Create empty list to hold names of the those measurement variables found in data table
act_col_list = {};
col_list_cnt = {};
// Run through data table column names and put those that match measurement variable list into new list
For( i = 1, i <= N Items( pot_col_list ), i++,
If( Contains( dtsum_col_name_list, pot_col_list[i] ),
Insert Into( act_col_list, pot_col_list[i] );
Insert Into( col_list_cnt, dtsum:pot_col_list[1,i] );
)
);
Show( col_list_cnt );