서로 다른 크기의 두 데이터 표를 반복하고 일치하는 값을 비교안녕하세요,
나는 다음과 같은 문제가있다 :
- 별도의 jmp 파일에 두 개의 데이터 테이블이 있으며 각 테이블에는 하나의 열이 있습니다.
- 한 테이블은 8 행, 다른 테이블은 6440 행입니다.
- 내 목표는 8 행 테이블의 각 값을 통해 6440 행 테이블의 모든 값과 비교하여 일치하는지 확인하는 것입니다.
- 두 테이블을 반복하고 싶기 때문에이 작업을 수행하는 방법에 대해 궁금한 점이 있지만 크기가 다릅니다. 중첩 된 for 루프를 사용하려고 생각했지만 너무 확신하지 못합니다.
어떤 도움을 주시면 감사하겠습니다.
다시 : 서로 다른 크기의 두 데이터 테이블을 반복하고 일치하는 값을 비교이전의 의사 코드 예제에서 약간의 오류가 발생했습니다.
dtShort:Compare Column[i] > dtLong:Compare Column</CODE></PRE>
<P><SPAN>논리가 작동하려면 되돌릴 필요가있다.</SPAN></P>
<PRE><CODE class=" language-jsl"> dtLong:Compare Column > dtShort:Compare Column[i]
다음은 실제 예제입니다.
Names Default To Here( 1 );
dtLong = Open( "$SAMPLE_DATA/Big Class.jmp" );
// Create the short data table
dtShort = New Table( "Short",
New Column( "Target Age", values( {12, 16} ) ),
New Column( "Match", character, values( {"Teenager", "Young Adult"} ) )
);
// Sort the data for illustration of data not being
// in age order
dtLong << sort( by( :Name ), replace table( 1 ) );
// Create a couple of new columns in the data table
dtLong << New Column( "Kind Of Match", character );
dtLong << New Column( "Count" );
// Process the data
For( i = 1, i <= N Rows( dtShort ), i++,
// Find all rows that match the Where Clause
theRowsFound = dtLong << get rows where( dtLong:Age > dtShort:Target Age[i] );
// If some rows were found process
If( N Rows( theRowsFound ) > 0,
// Set a value in the dtLong data table with one statement
// that sets values in multiple rows
dtLong:Kind Of Match[theRowsFound] = dtShort:Match[i];
// Now set values row by row for individual rows that were found
theCount = 1;
For( k = 1, k <= N Items( theRowsFound ), K++,
dtLong:Count[theRowsFound[k]] = theCount;
theCount = theCount + 1;
);
);
);다시 : 서로 다른 크기의 두 데이터 테이블을 반복하고 일치하는 값을 비교빠른 답변 감사합니다.
다음 부분 :
dtLong : Compare Column
열의 각 첨자 / 색인을 참조하지 않고도 열의 모든 값에 액세스하는 방법을 설명 하시겠습니까?
다시 : 서로 다른 크기의 두 데이터 테이블을 반복하고 일치하는 값을 비교여기 내가 어떻게 처리 할 것인가 .......
// This is pseudo code, but it will give you an idea of the flow
dtShort = Open( "<YOUR short="" data="https://community.jmp.com/" table="">" );
dtLong = Open( "<YOUR long="" data="https://community.jmp.com/" table="">" );
For( i = 1, i <= N Rows( dtShort ), i++,
theRowsFound = dtLong << get rows where( dtShort:Compare Column[i] > dtLong:Compare Column );
If( N Rows( theRowsFound ) > 0,
// Do your processing
);
);</YOUR></YOUR>
다시 : 서로 다른 크기의 두 데이터 테이블을 반복하고 일치하는 값을 비교답장을 보내 주셔서 감사합니다.
8 행 테이블의 값이 다음과 같은지 확인하려는 경우 어떻게 문제에 대해 제안 하시겠습니까? 더 큰 6440 행 테이블의 값보다?
다시 : 서로 다른 크기의 두 데이터 테이블을 반복하고 일치하는 값을 비교이 작업을 수행하는 가장 쉬운 방법은 JMP에서 작업을 수행하는 것입니다. 테이블을 새로운 테이블에 조인하면 Match 플래그라는 새 열을 JMP에서 만들 수 있습니다.이 열은 일치하는 항목이 있는지 없는지 알려줍니다
테이블 ==> 가입