大家好,我需要組合數據文件的每 6 列並使其成為一個新列。 我發現是否所有的組合列都可以存儲在新的數據文件中,只是為了簡化代碼。 請參閱我正在尋找的附加示例數據和輸出圖像。
另外,如何從列表中提取每個“n”元素/和第一個“n”元素?
請任何幫助。
謝謝。
給定您輸入的 JMP 表,下面的腳本會生成新列,如您的 JPG 文件所示。如果輸入數據是字符列或數字列,則 JSL 有效。

names default to here(1);
dt=current data table();
// Get all columns in data table
allCols = dt << get column names(character,string);
// Setup the names of the new columns to be created
varNames = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// Loop across the columns 6 at a time creating the new column
For(i=1,i<=nitems(allCols),i=i+6,
dtName = substr(varNames,(i+5)/6,1);
// Create the JSL command to generate the formula
theExpr = "new column(dtName, character,
formula(
theList = {};
insert into(theList,char(:\!"" || allCols[i] || "\!"n));
insert into(theList,char(:\!"" || allCols[i+1] || "\!"n));
insert into(theList,char(:\!"" || allCols[i+2] || "\!"n));
insert into(theList,char(:\!"" || allCols[i+3] || "\!"n));
insert into(theList,char(:\!"" || allCols[i+4] || "\!"n));
insert into(theList,char(:\!"" || allCols[i+5] || "\!"n));
Concat Items(theList,\!"-\!");
)
)";
// Run the created JSL
eval(parse(theExpr));
// Turn column values into static values
column(dt,dtName)<<DELETE formula=""></DELETE>