大家好,我需要组合数据文件的每 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>