Hello,
I am trying to generate a Summary table from a main datatable.
So far I was able to put all metrics in Column 1 with grouping (column 2).
I could then populate with Count, Mean, StdDev, +4sigma, -4sigma.
Next step is to add the confidence interval (95%) for Mean and STD: the same way it is done in the following analysis :
Fit Y by X > Means and Std Dev.
I could run ALL the analysis one-by-one with a FOR() loop and use DisplayBox to pick each values and populate my Summary data table, but I really would rather not, it would slow down the analysis by A LOT since I usually deal with 1000+ metrics and 10000+ rows.
Thanks in advance for your help
-Voiz
Attached my script that calls BIG CLASS.JMP as an example
Names Default To Here( 1 );
clear symbols();
Deletesymbols();
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
SplitBy = "sex";
//Get a list from all unique configs
summarize(ColumnSplitBy=by(Column (dt, SplitBy)));
show(ColumnSplitBy);
For( i = N Items( ColumnSplitBy ), i > 0, i--,
If( ColumnSplitBy[i] == "",
Remove From( ColumnSplitBy, i, 1 );
)
);
//Get only numeric Columns
MetricCols = dt << Get Column Names( numeric, continuous );
//Create a new table to collect the stats from the "Test" table
CpkTable = New Table( "Summary Table",
New Column( "Metric", "Character", "Nominal" ),
New Column( SplitBy, "Character", "Nominal" ),
New Column( "N", "Numeric", "Continuous" ),
New Column( "LSL", "Numeric", "Continuous" ),
New Column( "USL", "Numeric", "Continuous" ),
New Column( "Mean", "Numeric", "Continuous" ),
New Column( "StdDev", "Numeric", "Continuous" ),
New Column( "+4σ", "Numeric", "Continuous", formula(:Mean + :StdDev * 4) ),
New Column( "-4σ", "Numeric", "Continuous", formula(:Mean - :StdDev * 4) ),
);
show(MetricCols);
for(i=1,i <= N Items(MetricCols) ,i++,
show(i);
// Calculate Stats
Summarize(dt, exg = by(Column (dt, SplitBy)),
exc = Count((Column (dt, Eval(Eval Expr(Expr(Char(MetricCols[i]))))))),
exm = Mean((Column (dt, Eval(Eval Expr(Expr(Char(MetricCols[i]))))))),
exstd = StdDev((Column (dt, Eval(Eval Expr(Expr(Char(MetricCols[i]))))))),
);
Limits = Column(dt,MetricCols[i]) << GetProperty ("Speclimits");
//Loop to run through all configs and fill the table
For( j= 1 ,j <= NItems(ColumnSplitBy) , j++,
Show(j );
y = Eval Expr(
CpkTable << AddRows(
{:Metric = Expr(Char( MetricCols[i] ) ) ;
As Column(Splitby) = Expr(Char( ColumnSplitBy[j] ) ) ;
:LSL= Expr(Try(Limits["LSL"]));
:USL= Expr(Try(Limits["USL"]));
:N= exc[j];
:Mean= exm[j];
:StdDev= exstd[j];
};)
);
Print(y);
Try(Eval(y));
); //For j */
); //For i