Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Level II

Faster code for counting fliers

I have some code that uses the names in a column to check the # of rows in another datatable that are above or below an "outlier" threshold (which we want to just use a fixed value for) for that column.


code is below. we typically do this for 30 to 50 columns (so for each row iterates 30 to 50 times). it's currently taking 26 seconds, on a datatable (the one where outliers are being counted_ that only contains a small number (200) of rows. so something seems too slow.


i tried doing with tabulate, and was thinking of summarize - but i need to count above a simple threshold. any suggestions for how to do this more quickly? i need to be able to complete for artbitrary number of columsn, as stored in the "rankdt:Analysis Columns" in the code below.


i tried change "get rows where" to "select where", then counting selected rows - but this made no speed different.




for each row( // for each row in rankdt - 30 to 50 rows
	col_to_count = char(rankdt:Analysis Columns);
	rowsAbove= jdt<<get rows where(As Column(jdt, col_to_count) > outlier_flag_threshold);
	:Above flag =N rows(rowsAbove);
	rowsBelow= jdt<<get rows where(As Column(jdt, col_to_count) < -outlier_flag_threshold);
	:Below flag =N rows(rowsBelow);
Super User ms
Super User

Re: Faster code for counting fliers

Appears like a situation where either matrix calculations or use of the ColStat functions could speed things up. 

It's not clear to me how your tables and tresholds are organized. Could you share 

example tables?


Article Labels

    There are no labels assigned to this post.