cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
32103940
Level I

JMP script: How to create summary of a bunch of cols without specifying column names?

I'm looking to create a script which performs a series of steps, first of which is to create an N-statistic summary of an unspecified number of columns with unspecified names. The guides I've seen so far on jmp scripted summary tables require the column names to be specified.

 

I can specify the group, e.g. Group(:Column1), but I want all other columns from column2 onwards to have an N-summary created without having to specify their names.

 

any ideas?

2 REPLIES 2
Phil_Brown
Super User (Alumni)

Re: JMP script: How to create summary of a bunch of cols without specifying column names?

If I understand you correctly, maybe this will work. All strictly based on Column position.

 

For example, suppose you have a table where the columns of interest are at specified positions (colPos). Then....

statVect = [];
colPos = [1, 2, 8, 9, 14, 31, 32, 33, 36, 37, 38, 44, 49, 54, 55, 58, 59, 60, 61, 63, 69, 70,
72, 73, 79, 82, 85, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
102, 104, 105, 107, 112, 113, 115, 116, 117, 126, 132, 134, 136, 145, 149, 152, 154,
155, 156, 157, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 177];

meanExpr = Expr( Mean() );

For( i=1, i<= NRow( colPos ), i++,
	Eval(EvalExpr( InsertInto( meanExpr, NameExpr( Column( Expr(colPos[i]) )[] )  ) ));
);

For Each Row( statVect |/= meanExpr );

 

statVect will contain the result of Mean( Column(1), Column(2), Column(8), Column(9), ...., Column(177) ) for each row in the table.

PDB
ValarieSimmons
Level III

Re: JMP script: How to create summary of a bunch of cols without specifying column names?

Hi,

 

Maybe you can try this approach:

 

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

colname = dt << get column names( string );

dts = dt << Summary( N( Eval( colname ) ), Freq( "None" ), Weight( "None" ) );

colname2 = dts << get column names( string );

dts << Delete Columns( {colname2[1], colname2[2]} );  // delete N Rows & N(1st col in original data) columns

 Since you only wish to include other columns starting from column 2 onwards, I've added the last row of codes so that you can delete any rows before the 2nd column in your original data without even have to specify their names. 

 

Hope this helps! :)

 

Best Regards,

Val