When undertaking a new plumbing project, I always try to follow my two rules of plumbing. Rule One: Never start a plumbing project without beer in the fridge; you’ll get frustrated and need to take a break to calm down, and a beer works great for that. Rule Two: Never start a plumbing project (at home) within two hours of closing time at the hardware store; you will always find you need one more section of pipe or a fitting. It’s much too aggravating to wait until the next morning to get the part and fix the problem, before you can finally turn the water back on.
I find programming in general has much in common with plumbing. Applying similar rules to scripting in JMP Scripting Language (JSL), I substitute caffeinated drinks for the beer. And rather than drive off to the hardware store, I visit the scripting indexes.
If you write any JSL scripts, you may be interested to know the Object Scripting Index (OSI) now contains syntax, descriptions and examples for every message to each object. There are currently more than 2,600 distinct messages in all, and remembering the syntax for each would be challenging for anyone.
You’ll find the OSI under the Help menu. Three areas are particularly interesting pedagogically: the Data Table messages, the SAS Integration messages and the scripting only messages for Fit Model. I encourage you to explore other messages, especially in these areas, as I found many jewels tucked away there.
Data table: Scroll down to Data Table in the Objects panel, and then in the Messages panel try scrolling down to the message, “Unsubscribe.” Here, you see two parameter fields: The first is the name in string form, and the second is the action you want to trigger unsubscribing. The vertical bar between the options indicates the action can be one of four possible options.
To try it out, click “Run Example,” then close the data table and examine the log. In this example, when the subscription starts, JMP begins listening for events happening to the data table, just as it does when you run any analysis or graph. Subscription calls the print function passed in the On Close option and prints “Closing Data table” to the log when you close the data table. However, the unsubscribe call prevents the function call by canceling the subscription. If you delete or comment out the unsubscribe call, rerun the script, and close the data table, you’ll see “Closing Data table” appear in the log.
SAS Integration: In the OSI object panel, scroll down to the SAS Server object nested under the SAS Integration object. In the messages panel, scroll down to Submit. In this entry, you’ll find all parameters are optional, denoted with .
If you have SAS installed, try running this script. The SAS Connect() statement will run SAS locally and behind the scenes. After it completes, you’ll see two new output windows, both in JMP. One window contains the SAS output displayed as html and the other for the data table with a new column added for the residual.
Fit Model: The object entry for Fit Model is a placeholder for all the Fit Model personalities. In the Objects panel, scroll down to the Fit Least Squares under Fit Model, then to Save Coding Table in the Message panel. You’ll notice while scrolling that there are many Get functions, which many find useful when programming customized statistics.
When you run the example, besides the data table, Drug.jmp, you’ll see both a Standard Least Squares report appear and a new data table. In the new table, we see two columns for the variable, Drug. JMP creates n-1 columns (and parameter estimates), where n is the number of levels. The last level is represented by coding both columns -1. Rather than doing some algebra on the Parameter Estimates in the output to see the specific drug effects, we might decide we want to use the least squares mean values for each level of drug. You can see the Least Squares Means by opening the Effect Details section of the report.
If you’re anything like me, after a few initial tries, you’ll forget you'd never seen this before and reach for the OSI tool every time you are scripting. And unlike the hardware store, the OSI never closes.