열 목록에 해당하는 값 목록 만들기작업 중인 많은 데이터 테이블 중 하나에서 발생할 수 있는 잠재적인 열 이름 목록을 만들고, 열린 데이터 테이블에서 발견된 실제 열 목록을 만든 다음, 다음에 해당하는 값 목록을 만들려고 합니다. 실제 열 목록.그러나 다음 코드를 실행하면 순환하는 모든 열에 대해 목록의 첫 번째 열에서 값을 가져옵니다.이 코드는 {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: 열 목록에 해당하는 값 목록을 만듭니다.그랬구나, txnelson,
구문 오류를 살펴보고 수정하는 데 도움을 주셔서 감사합니다.
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 );