Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
JMP scripting is an important part of the JMP user experience. Anyone can easily create a reusable JMP "program" with JMP Scripting Language (JSL) by running an analysis, selecting the hotspot (red triangle) at the top of the report, and choosing "Script." From there, you can save a script to a data table, a script window, a journal, or a project.
But did you know that you can also write a script that can create or modify a data table? To see a script that creates a data table, follow these steps:
a) Open a data table in JMP.
b) Open a script window (File->New->Script).
c) In the script window, type Current Data Table() << get script; and run this script (Cntl-R or Edit->Run Script).
d) Open the JMP log (View->Log). In the JMP log, the script that recreates the data table is shown.
e) Copy and paste that script where you need it to go.
An example screenshot of what this process produces is shown below.
I tend to do this a lot, especially when I am preparing presentations using custom journals or when I need a starting version of a data table for a more complicated script. The multi-step process is tedious, so naturally, I wondered if I could write a JMP script that would automate that process. It turns out that it was a pretty simple script.
The JSL is below, and the script file is available for download from the JMP File Exchange.
// Save the script to a global variable
tblScript = Current Data Table() << Get Script;
// Create an empty script box object
scrBox = Script Box();
//You want the text version of tblScript, which
// is an expression. Char turns it into text.
//Name Expr returns the unevaluated expression
scrBox << Set Text(
//The script displays in a report window (note the icon
//in the upper left), but can be executed like a script.