Hi,
I want to open a data table (using Big Class.jmp as example, but want to do this for any table) and create a summary table for each column, returning the number of non-missing values for each column (as shown in table below).
N Rows | N(name) | N(age) | N(sex) | N(height) | N(weight) |
---|
40 | 40 | 40 | 40 | 40 | 40 |
I have tried two different approaches to this and have had no success (I'm using JMP 9.0.3 64bit).
In the first example, I try to pass a list of parsed strings {N(:name),N(:age),N(:sex),N(:height),N(:weight)} to Summary(). However, when I run this, it only creates a summary table with N Rows.
Example1
///////////////////////////////////////////////////////////////////////////////
Open( "$SAMPLE_DATA/Big Class.jmp" );
dt = current data table();
colList = dt<<Get Column Names();
icols = N Items(colList);
sumList={};
for(i=1, i<=icols, i++,
Insert Into(sumList, parse("N(:" || char(colList) || ")"))
);
summDt = dt<<Summary(Group, Eval(sumList), output table name("Summary_Table"));
///////////////////////////////////////////////////////////////////////////////
I then tried to define an expression and pass a parsed string (N(:name),N(:age),N(:sex),N(:height),N(:weight)). However, when I try to evaluate this expression, I get the following...
Unexpected ",". Perhaps there is a missing ";" or ",".
Line 1 Column 9: N(:name)►, N(:age), N(:sex), N(:height), N(:weight)
The remaining text that was ignored was
Example2
///////////////////////////////////////////////////////////////////////////////
Open( "$SAMPLE_DATA/Big Class.jmp" );
dt = current data table();
colList = dt<<Get Column Names();
icols = N Items(colList);
MyExpr = expr(summDt = dt<<Summary(Group, expr(parse(strColumns)), output table name("Summary_Table")));
for(i=1, i<=icols, i++,
if(i==1, strColumns = "N(:" || char(colList) || ")", strColumns = strColumns || ", N(:" || char(colList) || ")")
);
//bypass above for check
//strColumns = "N(:name)"; //will work for one column, but throws an error when I try to pass more than one column (i.e. "Unexpected ",". Perhaps there is a missing ";" or ",".")
test = Eval Expr(MyExpr);
test;
///////////////////////////////////////////////////////////////////////////////
I must be doing something silly.
Any advice/help would be greatly appreciated.
Thank you.