많은 연속 데이터 열과 대시보드 내에서 필터링하는 두 가지 범주형 요소가 있는 데이터 세트와 모든 플롯/분석을 분할하는 데 사용하는 추가 범주형 변수(그룹)가 있습니다. 또한 사용자가 각 연속 변수의 요약 테이블을 순환할 수 있는 기본 열 전환기가 있습니다. 기본 열 전환기는 대시보드 내의 플롯 및 분석에 있는 다른 모든 열 전환기에 연결됩니다. 따라서 모든 플롯과 분석은 한 번에 하나의 연속 변수를 표시하며 성별(남성/여성 또는 둘 다)로 필터링할 수 있습니다.
이 모든 것이 잘 작동하지만 각 연속 변수에 대한 요약 통계 테이블을 사용하고 새 변수(상대 변경)를 계산하는 새 테이블(dtSumm)을 만들 때 문제가 발생합니다. 이 새 요약 테이블에는 그룹 범주 수만큼의 행만 있고 성별이 없으므로 이제 이를 기준으로 필터링할 수 없습니다.
dtSumm의 코드는 다음과 같습니다.
// Create a separate datatable for treatment group means
dtSumm = dt << Summary (
Group (:Group,:Sex ),
Mean ( eval ( cols ) ),
statistics column name format( "column" ),
Link to original data table( 1 ),
invisible
);
// Add RC columns for each column in cols to dtSumm
//This works by getting the mean of each column for treatment group "A"
For( i = 1, i <= num, i++,
mean0 = Mean(Column(cols[i])[(dtSumm << get rows where( :"Group" == "A"))]);
dtSumm << New Column(
Char(cols[i]||"_RC"),
Formula( ( ( ( column( cols[i] )[]) - ( eval(mean0) ) ) / ( eval(mean0) ) ) * 100 )
);
);
모든 제안을 환영합니다. 감사 해요
질문을 설명하기 위해 예를 추가하는 것이 도움이 될 수 있습니다. (아래 JSL 참조)
이 예에서는 JMP 샘플 데이터의 AdverseR 데이터를 사용합니다. 목표는 다음과 같은 대시보드를 생성하는 것입니다.

SEX에 데이터 필터가 있음을 알 수 있습니다. 그리고 두 개의 표 보고서 및 분포에 요약된 "응답" 변수를 전환하는 열 전환기가 있습니다.
첫 번째 표(왼쪽)는 각 치료 그룹에 대한 평균 응답을 제공합니다.
두 번째 표(오른쪽)는 PBO 그룹에 대한 각 치료 그룹에 대한 반응의 평균 % 변화를 제공합니다. 이것은 각 치료 그룹에 대한 각 응답 평균의 요약 테이블("dtSumm")에서 실행됩니다.
문제는 데이터 필터가 이 두 번째 표 보고서를 제외한 모든 항목에서 작동한다는 것입니다. 이상적인 것은 dtSumm이 Data Filer 기준을 충족하는 데이터만 요약할 수 있는 것입니다. 데이터 필터의 선택 항목이 변경되면 dtSumm이 다시 생성됩니다.
그게 가능합니까?
// Open the data table
dt = Open( "$SAMPLE_DATA/AdverseR.jmp" );
//Define cols as the list of columns for column switcher to use
//This is essentially hard-coding the columns that will be used in the dashboard
//Edit the items in this list to change the columns used in the dashboard
cols = {"DAY ON DRUG", "AGE", "WEIGHT", "ADR DURATION"};
//Define num as the number of columns in the list, cols
num = length(cols);
// We create a separate data table for treatment group means
// Get table, dtSumm, of means by group for each column in cols
dtSumm = dt << Summary (
Group (:Name("TREATMENT GROUP")),
Mean ( eval( cols ) ),
statistics column name format( "column" ),
Link to original data table( 1 ),
invisible
);
// Add RC columns for each column in cols to dtSumm
//This works by getting the mean for "PBO" treatment group for each
For( i = 1, i <= num, i++,
mean0 = Mean(Column(cols[i])[(dtSumm << get rows where( :"TREATMENT GROUP" == "PBO"))]);
dtSumm << New Column(
Char(cols[i]||"_RC"),
Formula( ( ( ( column( cols[i] )[]) - ( eval(mean0) ) ) / ( eval(mean0) ) ) * 100 )
);
);
// Create dashboard with tables and Distribution plot
mainWindow=New Window( "Example",
H List Box(
dt << Current Data Table() << Data Filter(
Location( {55, 48} ),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) ),
Add Filter( columns( :SEX ) ) //
);
,
table1= dt << Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table(
Analysis Columns(
Column( cols[1] )
),
Statistics( Mean, N )
),
Row Table( Grouping Columns( :TREATMENT GROUP ) )
)
);
,
table2= dtSumm << Tabulate(
Change Item Label( Statistics( Mean, "%Rel Change" ) ),//Changes heading from "Mean"
Show Control Panel( 0 ),
Add Table(
Column Table( Analysis Columns( Char(cols[1]||"_RC") ), Statistics( Mean ) ),
Row Table( Grouping Columns( :TREATMENT GROUP ) )
)
);
,
dist0 = dt << Distribution(
Continuous Distribution(
Column( cols[1] ), //dt_c_col[1] uses first in column list
Always use column properties( 1 ),
Process Capability( 0 )
),
Histograms Only,
SendToReport(
Dispatch( {}, "Distribution", OutlineBox ),
Dispatch( {}, "Process 1", OutlineBox, {Close( 1 )} )
)
)
)
);
// Add a column switcher to table1
cs = table1 << Column Switcher(
cols[1],
cols
);
// Link column switchers at each platform - JMP 15 solution
cs1 = table2 << Column Switcher(
Char(cols[1]||"_RC"),
eval list(dtSumm << Get Column Names( String ))[(num+3)::(num+2+num)],
Close Outline( 1 )
);
cs2 = dist0 << Column Switcher(
cols[1],
cols,
Close Outline( 1 )
);
mainWindow[ListBoxBox( 1 )] << Set Script(
var = mainWindow[ListBoxBox( 1 )] << Get Selected;
cs1 << Set Current(Char(var[1]||"_RC"));
cs2 << Set Current(var[1]);
);
아마도 지금은 더 나은 방법이 있지만 과거에는 'makeFilterChangeHandler()'를 사용했습니다. 따라서 개요:
NamesDefaultToHere(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
// Report involving detail-level data
NewWindow("Detail and Summary Data with Local Data Filter", << onClose(Try(Close(dt2, noSave))),
hlb = HListBox(dist = dt << Distribution(Continuous Distribution( Column( :height ) )));
);
// Local data filter
ldf = dist << Local Data Filter( Add Filter( columns( :sex ) ) );
// This script will run each time the filter selection is changed
ldfChange =
Function( {a},
filteredRows = ldf << getFilteredRows;
// Try to close any open ancilary tables
Try(Close(dt2, noSave));
// Make a subset table according to the current selection
dt2 = dt << subset(Rows(filteredRows), Invisible);
// Aggregate the subset table
dt3 = dt2 << summary(Mean(:height), Invisible);
// Update the report
hlb << append(dt3 << Tabulate(Show Control Panel( 0 ), Add Table(Column Table( Analysis Columns( :"Mean(height)"n ), Statistics( Mean ) ))));
);
// Attach the script to the local data filter
rsh = ldf << makeFilterChangeHandler(ldfChange);