cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
etmsni
Level III

For Loop every two columns to perform the same function in a data table with n columns

Hi! I'm new to JSL scripting, and have tried to read the JSL reference manual/google JSL script examples. Could someone please point me in the direction on how to for loop every two columns to perform the same function in a JMP data table with n columns?

 

Basically I have a large data spreadsheet where every odd column is failure time, every even column is the censoring, and I would like to fit these data sets automatically n times. I know that if there was only two columns, I can click through the entire process on the JMP GUI interface and grab the script, but I'm not sure how to automate it to repeat the process again.

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: For Loop every two columns to perform the same function in a data table with n columns

Here is a simple example of repeating over a data table, 2 columns at a time

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\semiconductor capability.jmp" );

colNamesList = dt << get column names( continuous, string );

For( i = 1, i <= N Items( colNamesList ), i = i + 2,
	Bivariate(
		Y( colNamesList[i] ),
		X( colNamesList[i + 1] ),
		Fit Line( {Line Color( "Medium Dark Red" )} )
	)
);
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: For Loop every two columns to perform the same function in a data table with n columns

Here is a simple example of repeating over a data table, 2 columns at a time

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\semiconductor capability.jmp" );

colNamesList = dt << get column names( continuous, string );

For( i = 1, i <= N Items( colNamesList ), i = i + 2,
	Bivariate(
		Y( colNamesList[i] ),
		X( colNamesList[i + 1] ),
		Fit Line( {Line Color( "Medium Dark Red" )} )
	)
);
Jim
etmsni
Level III

Re: For Loop every two columns to perform the same function in a data table with n columns

Thank you so much!!! Really appreciate your help~ :)

Recommended Articles