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
bhweinermd
Level I

Is there a way to create analyses that can then be applied to different datasets?

I do the same multiple analyses on different data files.  Is there a way to create the analyses using one data file and then apply to different ones?  I hate having to repeat the same process all the time.

B

1 ACCEPTED SOLUTION

Accepted Solutions
julian
Community Manager Community Manager

Re: Is there a way to create analyses that can then be applied to different datasets?

Absolutely! With JMP scripting you can save the analyses you perform on the first dataset and then run the script on any new data you might have. To save a script first you need to perform the analysis, and then select the top-most red triangle, go to script, and select "Save Script to Script Window." This will save everything you did to create the analysis and any customizations you might have made on the output. You can perform many analyses and save the scripts to the same script window -- this way you can have a single script that will run all the analyses you need.

The script you save is not dataset specific (which means you can open a different dataset and run the script), but the script will reference the specific columns you recruited for the analysis. Do all your datasets have the same column names? If so, there's nothing more you need to do! Just save all the scripts you need and then open a new dataset and run the script (control-R on PC, command-R on a mac).   If your datasets have different column names you have a few options:

     1. Rename your columns to match the original dataset

     2. Use Find-and-replace to swap out the referenced column names in your script for each dataset

     3. Modify your script to prompt you for which columns to use.

This final option is probably the most powerful method since you can then use your script on any dataset without modification, but it does require that you learn a little JSL to design the interface. If you have some experience with programming I bet you will feel right at home with JSL, but if programming and scripting is new to you then you might want to stick with the more manual options. If you do decide that you wish to pursue the custom interface let me know and I would be happy to provide some references and guidance for creating a flexible script.

I hope this helps!

Julian

View solution in original post

7 REPLIES 7
julian
Community Manager Community Manager

Re: Is there a way to create analyses that can then be applied to different datasets?

Absolutely! With JMP scripting you can save the analyses you perform on the first dataset and then run the script on any new data you might have. To save a script first you need to perform the analysis, and then select the top-most red triangle, go to script, and select "Save Script to Script Window." This will save everything you did to create the analysis and any customizations you might have made on the output. You can perform many analyses and save the scripts to the same script window -- this way you can have a single script that will run all the analyses you need.

The script you save is not dataset specific (which means you can open a different dataset and run the script), but the script will reference the specific columns you recruited for the analysis. Do all your datasets have the same column names? If so, there's nothing more you need to do! Just save all the scripts you need and then open a new dataset and run the script (control-R on PC, command-R on a mac).   If your datasets have different column names you have a few options:

     1. Rename your columns to match the original dataset

     2. Use Find-and-replace to swap out the referenced column names in your script for each dataset

     3. Modify your script to prompt you for which columns to use.

This final option is probably the most powerful method since you can then use your script on any dataset without modification, but it does require that you learn a little JSL to design the interface. If you have some experience with programming I bet you will feel right at home with JSL, but if programming and scripting is new to you then you might want to stick with the more manual options. If you do decide that you wish to pursue the custom interface let me know and I would be happy to provide some references and guidance for creating a flexible script.

I hope this helps!

Julian

notoriousapp
Level III

Re: Is there a way to create analyses that can then be applied to different datasets?

Your explanation works well if you desire a graph or other platform output but what if you need to perform reoccurring manipulation on tables and you want to perform this task the same every time.  For example, let's say I wanted to do the following:

1) Paste data into JMP

2) Delete rows which are either blank or have key words in them which I need to filter out.

3) Change column type for 3 column from character to numeric

4) Table --> Summary

The data I'm pasting into JMP is the same format every time with the same column header names and column data types.

julian
Community Manager Community Manager

Re: Is there a way to create analyses that can then be applied to different datasets?

This can all be done with JSL as well, but will require some manual coding (except for the summary table, which generates a script upon running, saved to the data table scripts under "Source"). Do you have experience with JSL scripting or general programming? If not, I would recommend reading through the JSL Scripting Guide, which is available under Help > Books > Scripting Guide

To get you started, here's how I would get rid of the blank rows (blank values in a column named "TEST")

dt = Current Data Table();

dt << select where(:Test == "");

dt << delete rows;

This exact same code could be used to delete rows in which a column has the keywords you wish to select for, for instance, looking for the string "Useless Data" :

dt = Current Data Table();

dt << select where(:Test == "Useless Data");

dt << delete rows;

To change a column data type, you can use the following code (this references a column named "Test")


dt:Test << Data type( Numeric ) << Set Modeling Type( Continuous );

I hope this helps!

Julian

jennifer_n_blak
Level III

Re: Is there a way to create analyses that can then be applied to different datasets?

Hi Julian,

   Thanks for this helpful post. I am wondering, is there a way to annotate the script in the script window without disrupting the code (as you would in R with #)?

I don't do JSL, so it would be easier to note the type of analyses as I perform them so that I don't have to decipher lots of code later.

Thanks!

Jennifer

julian
Community Manager Community Manager

Re: Is there a way to create analyses that can then be applied to different datasets?

Hi @jennifer_n_blak,

Absolutely! The syntax for a comment in JSL is:

// this is a single line comment

/*
This
is a 
multi-line 
comment
*/ 

 

Julian

 

jennifer_n_blak
Level III

Re: Is there a way to create analyses that can then be applied to different datasets?

Thank you, Julian! That is most helpful!
Jennifer

ron_horne
Super User (Alumni)

Re: Is there a way to create analyses that can then be applied to different datasets?

Julian gave the best option to start with.

the next most efficient in terms of productivity improvement vs investment is this book:

http://www.sas.com/store/books/categories/usage-and-reference/jump-into-jmp-scripting/prodBK_61733_e...

this will upgrade your productivity after just a little reading.