안녕 모두, 나는 데이터 파일의 모든 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>
감사합니다. Nelson, 효과가 있었습니다.
다시 한번 감사합니다.