수식을 포함하는 열을 반복적으로 만듭니다.사양 제한이 있는 열을 반복하고 해당 열에 대한 분석을 수행하고 싶습니다.
New Column("WM Minus Target", Numeric, "Continuous", Format("Best", 10), Formula(:WN - (:WN << get property("Spec Limits"))["Target"]), Set Selected);여기에 있는 스크립트는 제가 원하는 것과 가깝습니다.
해결됨: 사양이 켜져 있을 때 실패 이름을 쓰고 싶을 때 스크립트를 어떻게 작성합니까? - JMP 사용자 커뮤니티
좀 더 복잡한 공식을 얻는 방법이 궁금하세요?
감사해요
스패너헤드
자동화 및 스크립팅Re: 수식을 포함하는 열을 반복적으로 생성합니다.분석 결과에 따라, 각 측정값에 대해 새로운 열을 추가하거나, 먼저 표를 쌓아서 새로운 열 하나를 만들 수 있습니다.
각 매개변수에 대한 새 열 추가
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");
cont_cols = dt << Get Column Names("Continuous", "String");
cols_created = {};
For Each({cont_col}, cont_cols,
specs = Column(dt, cont_col) << Get Property("Spec Limits");
If(Is Empty(specs), // skip columns without specs
Continue();
);
cur_target = Try(specs["Target"], .); // If target isn't set -> use 0 (could for example use USL - LSL?)
new_col = Eval(Substitute( // generally I use Eval(EvalExpr()) but in this case this makes expression more clear
Expr(dt << New Column(cont_col || " Minus Target", Numeric, Continuos, Formula(
_curcol_ - _targetval_
))),
Expr(_curcol_), Name Expr(AsColumn(dt, cont_col)),
Expr(_targetval_), cur_target
));
// new_col << Suppress Eval(1);
Insert Into(cols_created, new_col << get name);
);
그러면 이와 같은 열이 생성됩니다(열 속성을 변경하는 경우 대상은 업데이트되지 않음)

스태킹
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");
cont_cols = dt << Get Column Names("Continuous", "String");
ml = dt << Manage Limits(Process Variables(Eval(cont_cols))); // in this case this will open very annoying "help" window due to inconsistencies
dt_limits = ml << Save to Tall Limits Table;
ml << close window;
dt_stack = dt << Stack(
columns(Eval(cont_cols)),
Source Label Column("Measurement"),
Stacked Data Column("Data"),
Output Table("Data Stacked")
);
// If you don't care about LSL/USL they could be dropped from update
dt_stack << Update(
With(dt_limits),
Match Columns(:Measurement = :Variable),
Replace Columns in Main Table(None)
);
dt_stack << New Column("Data Minus Target", Numeric, Continuous, Formula(
:Data - :Target
));
두 가지 데이터 형식 모두 장단점이 있으며, 이는 수행하는 작업에 따라 달라집니다.
편집하다:
이렇게 하면 열 속성에서 값을 가져와야 하지만 다시 평가하지 않습니다(가능하다면 사용하지 않는 것이 좋습니다)
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");
cont_cols = dt << Get Column Names("Continuous", "String");
cols_created = {};
For Each({cont_col}, cont_cols,
specs = Column(dt, cont_col) << Get Property("Spec Limits");
If(Is Empty(specs), // skip columns without specs
Continue();
);
new_col = Eval(Substitute( // generally I use Eval(EvalExpr()) but in this case this makes expression more clear
Expr(dt << New Column(cont_col || " Minus Target", Numeric, Continuos, Formula(
_curcol_ - (_curcol_ << Get Property("Spec Limits"))["Target"]
))),
Expr(_curcol_), Name Expr(AsColumn(dt, cont_col))
));
//new_col << Suppress Eval(1);
Insert Into(cols_created, new_col << get name);
);
Re: 수식을 포함하는 열을 반복적으로 생성합니다.Jim의 Eval() 솔루션은 내 예제에서 수식이 제대로 표시되는 방법과 비슷해야 합니다.
Re: 수식을 포함하는 열을 반복적으로 생성합니다.Eval(Evalexpr())을 사용하지 않으면 실행 전에 공식 코드를 완전히 확장할 수 없습니다. 아래의 수정된 코드를 시도해 보세요.
Names Default To Here( 1 );
dt =
// Open Data Table: semiconductor capability.jmp
// → Data Table( "semiconductor capability" )
Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
colNames = dt << get column names( continuous, string );
For Each( {xcol}, colNames,
col = xcol;
theTarget = (Column( Eval( col ) ) << get property( "Spec Limits" ))["Target"];
Eval(
Eval Expr(
New Column( col || " Minus Target",
Numeric,
"Continuous",
Format( "Best", 10 ),
Formula( As Column( Eval( col ) ) - Expr( theTarget ) )
)
)
);
);Re: 수식을 포함하는 열을 반복적으로 생성합니다.흥미로워 보이는데, 오류가 나네요. 이름 미해결: 'theTarget'의 액세스 또는 평가에서 theTarget, theTarget/*###*/
Re: 수식을 포함하는 열을 반복적으로 생성합니다.코드는 작동하지만 결과 열의 수식을 살펴보면 다음과 같습니다.
As Column( Column( i ) ) - lstTargets[j]
Re: 수식을 포함하는 열을 반복적으로 생성합니다.그리고 또 다른 방법은 다음과 같습니다.
Names Default To Here( 1 );
dt =
// Open Data Table: semiconductor capability.jmp
// → Data Table( "semiconductor capability" )
Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
colNames = dt << get column names( continuous, string );
For each( {col}, colNames,
Eval(
Eval Expr(
theTarget = (Column( Eval( col ) ) << get property( "Spec Limits" ))["Target"];
New Column( Expr( col ) || " Minus Target",
Numeric,
"Continuous",
Format( "Best", 10 ),
Formula( As Column( Eval( col ) ) - Expr( theTarget ) )
);
)
);
);Re: 수식을 포함하는 열을 반복적으로 생성합니다.여기 한 가지 방법이 있습니다. 2개의 리스트 대신 연관 배열을 사용하면 더 우아할 수 있지만, 저는 2개의 리스트를 사용하는 것이 이해하기 더 쉽습니다.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Semiconductor Capability.jmp" );
lstCols = {};
lstTargets = {};
//get cols with targets
For Each( {i}, 1 :: N Col( dt ),
t = .;
Try( t = (Column( i ) << Get Property( "Spec Limits" ))["Target"], );
If( !Is Missing( t ),
Insert Into( lstCols, i );
Insert Into( lstTargets, t);
);
);
//make formulas
For Each( {i, j}, lstCols,
//i = 5; j = 1;
dt << New Column( char(Column Name( i )) || " Minus Target",
Numeric,
"Continuous",
Format( "Best", 10 ),
Formula( as column(Column( i )) - lstTargets[j] )
)
);
/*JMP STATISTICAL DISCOVERY LLC (“JMP”) PERMITS THE USE OF THIS COMPUTER SOFTWARE CODE (“CODE”) ON AN AS-IS BASIS AND AUTHORIZES YOU TO USE THE CODE SUBJECT TO THE TERMS LISTED HEREIN. BY USING THE CODE, YOU AGREE TO THESE TERMS. YOUR USE OF THE CODE IS AT YOUR OWN RISK. JMP MAKES NO REPRESENTATION OR WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRIGEMENT, AND TITLE, WITH RESPECT TO THE CODE.
You may use the Code solely as part of a software product you currently have licensed from JMP, JMP’s parent company SAS Institute Inc. (“SAS”), or one of JMP’s or SAS’s subsidiaries or authorized agents (the “Software”), and not for any other purpose. The Code is designed to add functionality to the Software but has not necessarily been tested. Accordingly, JMP makes no representation or warranty that the Code will operate error-free. JMP is under no obligation to maintain, support, or continue to distribute the Code.
Neither JMP nor its licensors shall be liable to you or any third-party for any general, special, direct, indirect, consequential, incidental, or other damages whatsoever arising out of or related to your use or inability to use the Code, even if JMP has been advised of the possibility of such damages. Except as otherwise provided above, the Code is governed by the same agreement that governs the Software. If you do not have an existing agreement with JMP or SAS governing the Software, you may not use the Code.
JMP and all other JMP Statistical Discovery LLC product or service names are registered trademarks or trademarks of JMP Statistical Discovery LLC in the USA and other countries. ® indicates USA registration. Other brand and product names are registered trademarks or trademarks of their respective companies.
*/