다른 데이터 테이블의 데이터를 기반으로 열 축 참조선 업데이트가능한 다른 데이터의 데이터를 기반으로 열 참조 라인을 추가하려고합니다. 예를 들어 "빅 클래스"를 사용하면 조회 데이터 테이블의 P50 및 P95 값으로 "체중" 및 "높이" 열이 업데이트됩니다.
조회 데이터 테이블의 행은 기본 테이블의 열 이름에 해당합니다. 참조 라인은 조회 테이블 열 이름 "P50" 또는 "P95"의 레이블 값을 할당해야 하며 값은 해당 열의 행에서 가져옵니다.
추가된 열 축 참조선을 보여주는 예:

조회 데이터 테이블의 예:

저는 JSL에 정통하지 않기 때문에 이 주제에 대해 도움을 주시면 감사하겠습니다. 스크립트를 만들었지만 원하는 대로 되지 않습니다.
열을 손상시키는 것 같습니다. 때때로 분포를 그릴 때 모든 '0' 값이 표시됩니다. 또한 P50 및 P95 참조 라인을 모두 추가하려고 하면 마지막 하나만 열에 저장되고 두 열에 모두 저장됩니다.
dt = Open ("C:\Program Files\SAS\JMP\15\Samples\Data\big class.jmp");
dtLookup = New Table( "Lookup Table",
Add Rows( 2 ),
New Column( "Column Name",
Character,
Nominal,
Set Values( {"weight", "height"} )
),
New Column( "P50",
"Continuous",
Set Values( [100, 61] )
),
New Column( "P95",
"Continuous",
Set Values( [120, 70] )
)
);
col_name_list = dt << get column names(string);
col_name_list_lookup = dtLookup << get column names(string);
numRowsLookup = N Rows( dtLookup );
numColsLookup = N Cols( dtLookup );
for(n=1,n<=numRowsLookup,n++,
col_name = dtLookup[n,1];
If(contains(col_name_list,col_name),
for(j=2,j<=numColsLookup,j++,
col = Column(dt, col_name);
col_name_Lookup = col_name_list_lookup[j];
value = Column(dtLookup,col_name_Lookup)[n];
col <<
Set Property("Axis",
{
//Add Ref Line( 63, "Dashed", "Orange", "P50", 2 )
Add Ref Line( value, "Dashed", "Orange", col_name_Lookup, 2 )
});
);
);
);
고맙습니다,
알았다
스크립팅Re: 다른 데이터 테이블의 데이터를 기반으로 열 축 참조선 업데이트여기서 최종 업데이트. Jarmo에게 특별한 감사를 드립니다.
나는 이것을 의도 한대로 작동시킬 수있었습니다. 나중에 참조할 수 있도록 여기에 최종 코드가 있습니다.
Names Default To Here(1);
namespace("here")<<REMOVE></REMOVE> New Column("P99", "Continuous", Set Values([125, 75]))
);
col_name_list = dt << get column names(string);
col_name_list_lookup = dtLookup << get column names(string);
For Each Row(dtLookup,
col_name =:"Analysis Columns"n; //Ref column name
new_properties = {}; // re-init
old_properties = {}; // re-init
If(contains(col_name_list,col_name),
old_properties = Column(dt, col_name) << get property("Axis");
//Add Multiple Ref Lines
For( i = 2, i <= N Items( col_name_list_lookup ), i++,
new_properties_temp =
EvalExpr({
Add Ref Line(Expr(as column(dtLookup,col_name_list_lookup[i])), "Dashed", Expr(Color To RGB( 67 )),Expr(char(col_name_list_lookup[i])), 1)
});
new_properties = Insert(new_properties, new_properties_temp);
);
//end Add Multiple
//Add Specified Reference Lines
//new_properties = EvalExpr({
// Add Ref Line(Expr(:P50), "Dashed", "Orange", "P50", 2),
// Add Ref Line(Expr(:P95), "Dashed", "Orange", "P95", 2)
//});
If(!IsList(old_properties),
prop_to_add = Name Expr(new_properties),
prop_to_add = Insert(old_properties, new_properties);
);
//show(prop_to_add); // for debug
Eval(EvalExpr(Column(dt, col_name) << Set Property("Axis",expr(prop_to_add)))); //Applies the new axis settings.
);
);
Re: 다른 데이터 테이블의 데이터를 기반으로 열 축 참조선 업데이트안녕하세요 자모입니다.
도움을 주셔서 감사합니다. 불행히도 여기에서 업데이트되는 이전 및 새 축 속성을 보지 못했습니다. "prop_to_add" 목록에 이전 속성과 새 속성이 추가되는 것을 보았지만 실제 축 설정을 확인할 때 두 개의 새 속성만 보았습니다.
설정된 속성에서 중괄호를 제거한 후 예상대로 작동할 수 있었습니다!
이제 N개의 조회 열에서 이 작업을 수행하기만 하면 됩니다.
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dtLookup = New Table("Lookup Table",
Add Rows(2),
New Column("Column Name", Character, Nominal, Set Values({"weight", "height"})),
New Column("P50", "Continuous", Set Values([100, 61])),
New Column("P95", "Continuous", Set Values([120, 70]))
);
col_name_list = dt << get column names(string);
col_name_list_lookup = dtLookup << get column names(string);
Column(dt, "weight") << Set Property("Axis", {Add Ref Line(10, "Dashed", "Red", "P10", 2)}); //debugging axis property
//stop();
For Each Row(dtLookup,
//stop();
Row() = 1;
col_name = Column(dtLookup, "Column Name")[Row()]; //easier to work with without For Each Row
If(contains(col_name_list,col_name),
old_properties = Column(dt, col_name) << get property("Axis");
//stop();
new_properties = EvalExpr({Add Ref Line(Expr(:P50), "Dashed", "Orange", "P50", 2), Add Ref Line(Expr(:P95), "Dashed", "Orange", "P95", 2)});
//stop();
If(!IsList(old_properties),
prop_to_add = Name Expr(new_properties),
prop_to_add = Insert(old_properties, new_properties);
);
show(prop_to_add);
//stop();
//Eval(EvalExpr(Column(dt, col_name) << Set Property("Axis",{Expr(prop_to_add)}))); // Didn't work with the braces.
Eval(EvalExpr(Column(dt, col_name) << Set Property("Axis",expr(prop_to_add)))); //Worked when removing the braces.
);
);Re: 다른 데이터 테이블의 데이터를 기반으로 열 축 참조선 업데이트코드를 부분적으로 디버깅해 볼 수 있습니다. 루프 대신 Row() = rownumber를 사용하여 행별로 For Each Row를 "실행"할 수 있습니다.
//For Each Row(dtLookup,
Row() = 1;
col_name =:"Column Name"n;
If(contains(col_name_list,col_name),
old_properties = Column(dt, col_name) << get property("Axis");
old_with_new = Insert(old_properties,
{Expr( Add Ref Line(Expr(:P50), "Dashed", "Orange", "P50", 2),
Add Ref Line(Expr(:P95), "Dashed", "Orange", "P95", 2)
)
});
Eval(EvalExpr(Column(dt, col_name) << Set Property("Axis",{
Expr(old_with_new)
})));
);
);
그런 다음 행별로 코드 실행을 시작합니다.
old_properties = Column(dt, col_name) << get property("Axis");
//Empty()
디버깅을 위한 몇 가지 중단점(저는 디버거를 사용하지 않지만 디버거를 사용하면 훨씬 더 쉬울 것입니다):
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dtLookup = New Table("Lookup Table",
Add Rows(2),
New Column("Column Name", Character, Nominal, Set Values({"weight", "height"})),
New Column("P50", "Continuous", Set Values([100, 61])),
New Column("P95", "Continuous", Set Values([120, 70]))
);
col_name_list = dt << get column names(string);
col_name_list_lookup = dtLookup << get column names(string);
Column(dt, "weight") << Set Property("Axis", {Add Ref Line(10, "Dashed", "Red", "P10", 2)}); //debugging axis property
stop();
For Each Row(dtLookup,
stop();
Row() = 1;
col_name = Column(dtLookup, "Column Name")[Row()]; //easier to work with without For Each Row
If(contains(col_name_list,col_name),
old_properties = Column(dt, col_name) << get property("Axis");
stop();
new_properties = EvalExpr({Add Ref Line(Expr(:P50), "Dashed", "Orange", "P50", 2), Add Ref Line(Expr(:P95), "Dashed", "Orange", "P95", 2)});
stop();
If(!IsList(old_properties),
prop_to_add = Name Expr(new_properties),
prop_to_add = Insert(old_properties, new_properties);
);
show(prop_to_add);
stop();
Eval(EvalExpr(Column(dt, col_name) << Set Property("Axis",{Expr(prop_to_add)})));
);
);
삽입을 위한 스크립팅 인덱스:

스크립팅에 도움이 되는 몇 가지 링크:
JSL 구문 참조
스크립팅 가이드
JMP 16 도움말
Re: 다른 데이터 테이블의 데이터를 기반으로 열 축 참조선 업데이트여기서 Insert() 함수는 무엇을 합니까? 나는 그것이 작동하지 않는 것 같다.
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dtLookup = New Table("Lookup Table",
Add Rows(2),
New Column("Column Name", Character, Nominal, Set Values({"weight", "height"})),
New Column("P50", "Continuous", Set Values([100, 61])),
New Column("P95", "Continuous", Set Values([120, 70]))
);
col_name_list = dt << get column names(string);
col_name_list_lookup = dtLookup << get column names(string);
For Each Row(dtLookup,
col_name =:"Column Names"n;
If(contains(col_name_list,col_name),
old_properties = Column(dt, col_name) << get property("Axis");
old_with_new = Insert(old_properties,
{Expr( Add Ref Line(Expr(:P50), "Dashed", "Orange", "P50", 2),
Add Ref Line(Expr(:P95), "Dashed", "Orange", "P95", 2)
)
});
Eval(EvalExpr(Column(dt, col_name) << Set Property("Axis",{
Expr(old_with_new)
})));
);
);Re: 다른 데이터 테이블의 데이터를 기반으로 열 축 참조선 업데이트100% 확신할 수는 없지만 먼저 << Get Propery("Axis") 를 사용하여 이전 Axis 속성을 가져온 다음 추가할 수 있습니다.
다음과 같을 수 있습니다(더 간단한 방법도 있을 수 있음).
old_properties = Column(dt, "height") << get property("Axis");
old_with_new = Insert(old_properties, Expr(Add Ref Line(1, "Dashed", "Orange", "P45", 2)));
Eval(EvalExpr(column(dt, "height") << Set Property("Axis",{expr(old_with_new)})));Re: 다른 데이터 테이블의 데이터를 기반으로 열 축 참조선 업데이트감사합니다. 이 솔루션은 훨씬 간단하지만 기존 축 참조 라인을 덮어쓰는 것 같습니다. 해당 열에 이미 있는 Axis Ref Lines를 보존하는 방법이 있는지 알고 있습니까?
Re: 다른 데이터 테이블의 데이터를 기반으로 열 축 참조선 업데이트다음은 예제 스크립트입니다. 내 생각에 Axis는 그런 식으로 여러 번 시도하면 재정의되므로 동일한 << Set Property에 추가해야 할 수도 있습니다(이를 수행하기 위해 표현식을 빌드하는 여러 다른 방법).
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dtLookup = New Table("Lookup Table",
Add Rows(2),
New Column("Column Name", Character, Nominal, Set Values({"weight", "height"})),
New Column("P50", "Continuous", Set Values([100, 61])),
New Column("P95", "Continuous", Set Values([120, 70]))
);
For Each Row(dtLookup,
col_name =:"Column Name"n;
//because we know we have only two lines to add and they are always added
Eval(EvalExpr(Column(dt, col_name) << Set Property("Axis", {
Add Ref Line(Expr(:P50), "Dashed", "Orange", "P50", 2),
Add Ref Line(Expr(:P95), "Dashed", "Orange", "P95", 2)
}))
);
);

확실하지 않은 경우 평가(EvalExpr()) 여기에 필요하지만 아프지 않을 것입니다.
제목: 다른 데이터 테이블의 데이터를 기반으로 열 축 참조선 업데이트데이터를 Axis로 직접 가져오는 데 매우 유용한 JSL 스크립트입니다. 위 JSL 스크립트에 아래 레이블 설정을 추가할 수 있을까요?
추가 설정을 통해 귀하의 코드를 수정/추가하려고 시도했지만 오류가 발생했습니다.
For( i = 2, i <= N Items( col_name_list_lookup ), i++,
새로운 속성 임시 =
평가Expr({
참조 라인 추가(Expr(as column(dtLookup,col_name_list_lookup[i])), "대시", Expr(Color To RGB( 0 )),Expr(char(col_name_list_lookup[i])), 1,
레이블 위치("인라인 내부"), 반대축(1))
)
});
new_properties = Insert(new_properties, new_properties_temp);
);

제목: 다른 데이터 테이블의 데이터를 기반으로 열 축 참조선 업데이트모든 괄호가 올바른 위치에 있는지 확인하십시오.
더 보기...
For(i = 2, i <= N Items(col_name_list_lookup), i++,
new_properties_temp = Eval Expr(
{Add Ref Line(
Expr(As Column(dtLookup, col_name_list_lookup[i])),
"Dashed",
Expr(Color To RGB(0)),
Expr(Char(col_name_list_lookup[i])),
1,
Label Position("Inside Inline"),
Opposite Axis(1)
)}
);
new_properties = Insert(new_properties, new_properties_temp);
);