列のリストに対応する値のリストを作成する操作する多くのデータテーブルの 1 つで発生する可能性のある列名のリストを作成し、開いたデータテーブルで見つかった実際の列のリストを作成してから、それに対応する値のリストを作成しようとしています。実際の列リスト。ただし、次のコードを実行すると、循環するリストにあるすべての列について、リストの最初の列から値が取得されます。このコードの結果は、リスト = {13.975, 105} ではなく、{13.975, 13.975} になります。これについてさまざまな反復を試みましたが、正しい値を取得できません。ご提案をいただければ幸いです。
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 );Re: 列のリストに対応する値のリストを作成するそれはできました、テキネルソン、
ご覧いただきありがとうございます。構文エラーの修正にご協力ください。
Re: 列のリストに対応する値のリストを作成するPot_col_list から値を取得するために使用される参照が無効です。機能するように見える修正については、以下を参照してください。
names default to here(1);
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, column(dtsum,pot_col_list[i])[1] );
)
);
Show( col_list_cnt );