SQL에 익숙하십니까? 이렇게 하면 다른 키에 대해 다른 인덱스를 갖는 기타 정보 문제를 피할 수 있습니다. JMP 테이블에 대한 쿼리를 작성하여 다음 형식으로 가져올 수 있습니다.

그런 다음 요약 및 분할 테이블을 만들고 함께 조인하십시오.
요약:

나뉘다:

분할이 요약으로 업데이트됨:

Names Default To Here(1);
dt = Current Data Table();
dt_query = Query(
Table(dt, "INFO"),
"\[
select t1.assay, t1."Useful info 2" as "Control Lot number",
t1."Useful info 4" as "Control result", t1."Value for other info", t2."Value for other info"
from INFO t1
join INFO t2 on "Result for " || t1."Other info" = t2."Other info" and t1.assay = t2.assay
]\"
);
dt_summary = dt_query << Summary(
Group(:Assay, :Control Lot number, :Control result),
Freq("None"),
Weight("None"),
Link to original data table(0)
);
dt_split = dt_query << Split(
Split By(:Value for other info),
Split(:Value for other info 2),
Group(:Assay),
Remaining Columns(Drop All),
Sort by Column Property
);
dt_summary << Update(With(dt_split), Match Columns(:Assay = :Assay));
//Close(dt_summary, No save);
편집하다:
쿼리가 작동하도록 원래 데이터 열 기타 정보 "유용한 정보 X" 값을 "유용한 정보 X"(소문자)로 다시 코딩해야 했습니다. SQL 쿼리에서도 수행할 수 있습니다.
나는 이것을 몇 부분으로 할 것입니다
- Assay, Control Lot Number 및 Control Result 얻기는 요약을 통해 상당히 쉽게 수행할 수 있습니다.
- 기타 정보 인덱스가 변경됨에 따라 휴식을 취하는 것이 조금 더 어렵습니다(항상 동일하다면 이것은 매우 간단한 재코딩 및 분할일 것입니다).
- 그룹화에 따라(어세이만? 어세이 + 컨트롤 로트 번호?) 연관 배열을 사용하면서 데이터 테이블을 반복하고 값을 추가합니다.
코드가 매우 지저분합니다(부분적으로는 For Each를 사용할 수 없고 제가 게을러서입니다).
Names Default To Here(1);
dt = New Table("Untitled",
Add Rows(22),
New Column("Assay", Numeric, "Continuous", Format("Best", 12), Set Values([1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3])),
New Column("Useful info 1",
Character(18),
"Nominal",
Set Values(
{"Control Lot number", "Control Lot number", "Control Lot number", "Control Lot number", "Control Lot number", "Control Lot number",
"Control Lot number", "Control Lot number", "Control Lot number", "Control Lot number", "Control Lot number", "Control Lot number",
"Control Lot number", "Control Lot number", "Control Lot number", "Control Lot number", "Control Lot number", "Control Lot number",
"Control Lot number", "Control Lot number", "Control Lot number", "Control Lot number"}
)
),
New Column("Useful info 2",
Character(16),
"Nominal",
Set Values(
{"abcdefg", "abcdefg", "abcdefg", "abcdefg", "abcdefg", "abcdefg", "abcdefg", "abcdefg", "abcdefg", "abcdefg", "abcdefg", "abcdefg",
"abcdefg", "abcdefg", "abcdefg", "abcdefg", "abcdefg", "abcdefg", "abcdefg", "abcdefg", "abcdefg", "abcdefg"}
)
),
New Column("Useful info 3",
Character(16),
"Nominal",
Set Values(
{"Control result", "Control result", "Control result", "Control result", "Control result", "Control result", "Control result",
"Control result", "Control result", "Control result", "Control result", "Control result", "Control result", "Control result",
"Control result", "Control result", "Control result", "Control result", "Control result", "Control result", "Control result",
"Control result"}
)
),
New Column("Useful info 4",
Numeric,
"Continuous",
Format("Best", 12),
Set Values([10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10])
),
New Column("Other info",
Character(24),
"Nominal",
Set Values(
{"Useful info 5", "Useful info 6", "Result for useful info 5", "Result for useful info 6", "Useful info 5", "Useful info 6",
"Useful info 7", "Useful info 8", "Result for useful info 5", "Result for useful info 6", "Result for useful info 7",
"Result for useful info 8", "Useful info 5", "Useful info 6", "Useful info 7", "Useful info 8", "Useful info 9",
"Result for useful info 5", "Result for useful info 6", "Result for useful info 7", "Result for useful info 8",
"Result for useful info 9"}
)
),
New Column("Value for other info",
Character(16),
"Nominal",
Set Values(
{"Method ID", "Method Version", "Method x", "1", "Method ID", "Method Version", "Sample result", "Equipment Number", "Method x", "1",
"12", "123456", "Method ID", "Method Version", "Sample result", "Equipment Type", "Equipment Number", "Method x", "1", "12", "Reader",
"123456"}
)
)
);
dt_result = dt << Summary(
Group(:Assay, :Useful info 2, :Useful info 4),
Freq("None"),
Weight("None"),
Link to original data table(0)
);
a_m = dt[0, "Assay"];
aa = Associative Array(a_m);
// will use slower for loop due to usage of JMP14 instead of For Each
aa_keys = aa << get keys;
For(i = 1, i <= N Items(aa_keys), i++,
// initialize associative array to aa
aa[aa_keys[i]] = Associative Array();
//Get rows for current assay
cur_rows = Loc(a_m, aa_keys[i]);
//
aa_temp = Associative Array(dt[cur_rows, "Other info"], dt[cur_rows, "Value for other info"]);
aa_temp_keys = aa_temp << get keys;
For(k = i, k <= N Items(aa_temp_keys), k++,
// if starts with Useful info -> this will be new key to aa[aa_keys]
If(Starts With(aa_temp_keys[k], "Useful info"),
aa[aa_keys[i]][aa_temp[aa_temp_keys[k]]] = aa_temp["Result for " || Lowercase(aa_temp_keys[k])]; // get value
);
);
);
//then loop over the AA to set values to dt_result. create new columns as you go
aa_keys = aa << get keys;
For(i = 1, i <= N Items(aa_keys), i++,
aa_new_cols = aa[aa_keys[i]];
cur_cols = Associative Array(dt_result << get column names("String"));
aa_new_cols << Remove(cur_cols);
new_cols = aa_new_cols << get keys;
For(k = 1, k <= N Items(new_cols), k++,
dt_result << New Column(new_cols[k], Character, Nominal);
);
dt_result[i, aa[aa_keys[i]] << get keys] = aa[aa_keys[i]] << get values;
);
