A script to check and change a JMP preference ($2)

by on Dec.23, 2010 , under scripts

Mar­i­anne Toft asked the JMP script­ing group on LinkedInques­tion about man­ag­ing pref­er­ences with JSL:

Does any­body know how to read a spe­cific set­ting from the Pref­er­ences? I need to read the sta­tus of ‘Use JMP locale set­tings’ and if 0 then change to 1 and give the user a mes­sage to restart JMP.

Sev­eral peo­ple had help­ful sug­ges­tions, but unfor­tu­nately it’s just not a triv­ial prob­lem. It’s a sur­pris­ingly tricky problem.


First, by default Show Preferences() only shows the pref­er­ences that you’ve taken to change. You need to use Show Preferences(all) to see the defaults listed, too.

Sec­ond, Show Preferences(SomeSpecificPreferenceHere), although a good guess, doesn’t actu­ally work. You’ll just get the usual out­put for Show Pref­er­ences() with­out an argument.

Les­son: when you sup­ply an argu­ment JMP doesn’t under­stand, some­times you get errors, but a lot of the time it’s just ignored, silently. You get no indi­ca­tion that you did some­thing that doesn’t work. The only way you can be sure it was ignored is to try it again with­out the argu­ment, or with a dif­fer­ent argu­ment, and check whether any­thing changed.

Third, Show Preferences( [all] ) doesn’t return an expres­sion. It returns miss­ing. The infor­ma­tion you need is echoed to the Log win­dow, but it’s not returned as a string or an expres­sion or a list or any­thing else you’d be able to do some work on. So you need to over­come that.

How to solve the basic problem

In JMP 9, you can Get Log(), which returns a list of strings, one for each line of whatever’s in the log. So to work effi­ciently, you need to Clear Log() first, then Show Preferences(all), then do Get Log().

Well! Now you have a list of strings, and you need to find the item in that list that is rel­e­vant, so you need to put a Contains() test inside a For() loop.

It’s a string, so you have to trans­form it into an expres­sion with Parse() and some other book­keep­ing, so that you can probe its argu­ment with Arg().

Then check whether the argu­ment is the desired one, and if not, change it, by edit­ing the expres­sion with Substitute() and then imme­di­ately doing Eval() on the result of that.

Now we need to let the user know we did some­thing, and per­haps that they need to restart. So, put up a New Window() with a Text Box() say­ing that a pref­er­ence has changed and they need to restart. Include a Button Box() for “OK” that closes the alert window.

So, that’s the gist of the strategy.

Abstract the script

But, why write all this just for this one spe­cific pref­er­ence? Why not write it to check and if nec­es­sary change any preference?

So, start out with a cou­ple glob­als that set the pref­er­ence and the desired value.

But wait! Marianne’s exam­ple involves a numeric argu­ment, but other pref­er­ences have text argu­ments; con­sider Use JMP Locale Settings(0) vs. Report Table Style("Plain"). So we need to make sure our script can work prop­erly whether the par­tic­u­lar pref­er­ence takes a numeric or string value.

And while Marianne’s exam­ple requires a restart for the changed pref­er­ence to take effect, most pref­er­ences do not. Might as well set a restartNeeded=1 if it’s impor­tant, or 0 if it’s not.

In that alert win­dow, we only need to tell them to restart if it’s impor­tant, not if it’s not, so let’s add an If Box() around the Text Box() that only shows the instruc­tion if it’s needed.

If the pref­er­ence was what we wanted in the first place, we should prob­a­bly echo some­thing to the Log win­dow, just so we know it ran, if noth­ing else. We need a Write() state­ment for that.

Which ver­sion of JMP?

But wait, there’s more! The Get Log() com­mand didn’t come along until JMP ver­sion 9. If you haven’t been able to upgrade yet, then you need to take another strat­egy to this whole problem.

There might be a bet­ter way to do this, but the only way I could find was to Save Log() to a text file, then Load Text File() to a string, then use Substr() and a bunch of argu­ments with Contains() to chop out the sin­gle pref­er­ence we care about. From there, the script runs about the same way.

And we need to put all this inside a test for JMP Version(), which returns a string, and usu­ally we need to Trim() it and then do an inequal­ity test, e.g. If( Trim( JMP Version() ) > "9", …), where the first argu­ment is the Get Log() strat­egy described first, and the sec­ond argu­ment uses the Save Log() strategy.

What about nested preferences?

Yet another prob­lem! The script so far deals with top-level pref­er­ences with sim­ple, sin­gle argu­ments, either numeric or char­ac­ter. But some pref­er­ences are trick­ier, e.g.,

      Monospaced Font("Courier", 10)

In this case, the Parse() line will need to be more elab­o­rate, and you’ll have to nest more Arg()s around it to dig down to the par­tic­u­lar set­ting value of inter­est. Con­di­tion­ing for such a sit­u­a­tion is left as an exer­cise for the reader, pri­mar­ily because it’s a has­sle, it’s not what Mar­i­anne needs, and the syn­tax of the Preferences() com­mand in JMP is arbi­trary enough that we can’t really write code today that will be future-proof; we don’t know how deeply nested a given pref­er­ence might be, nor what kind of argu­ments it might expect.

Nev­er­the­less, the core of the script should be use­ful for any­body need­ing to query and change most pref­er­ences, and the elab­o­ra­tion nec­es­sary to adapt this script to a more deeply nested pref­er­ence isn’t too complicated.

If you have any trou­ble with it, though, please feel free to con­tact us at Global Prag­mat­ica LLC®; we’ll be happy to cus­tomize this script fur­ther for you at a nom­i­nal cost.

Pur­chase the code for $2

A fin­ished, work­ing, version-neutral script that has been tested on JMP 8 and 9 on Mac and Win­dows is avail­able for pur­chase and imme­di­ate down­load for $2 US.

I am send­ing Mar­i­anne a coupon code for a com­pli­men­tary copy, with my thanks for her intrigu­ing question.

While the script itself might not be of imme­di­ate use to most read­ers, I hope that the strate­gies seen in the script will be of far greater value. Please con­tact me if you are in any way dis­ap­pointed in the script, and I will arrange for an imme­di­ate bug-fix or refund upon receipt of your concerns.

Editable script: $2.00

1 Comment more...

One Proportion Test (99¢ JSL widget!)

by on Jul.21, 2010 , under scripts, widgets

One Pro­por­tion Test is a JMP script for per­form­ing a One Pro­por­tion Test quickly and easily.


This script is inspired by a recent ques­tion on the LinkedIn Group “JMP Pro­fes­sional Net­work” from Jen­nifer Atlas, Senior Busi­ness Devel­op­ment Coör­di­na­tor at Minitab, who asked:

I know I can cal­cu­late a sam­ple size for a one pro­por­tion test in JMP, but how do I test for 1 proportion?

Karen Copeland, Ph.D., from Boul­der Sta­tis­tics promptly gave a help­ful expla­na­tion of how to do it in JMP. JMP han­dles the prob­lem quite capa­bly, but you have to know where to find it and remem­ber a bunch of details about how to use it:

To test one pro­por­tion in JMP I use the dis­tri­b­u­tion plat­form. When you run a dis­tri­b­u­tion for a nom­i­nal vari­able then in the red drop down menu there is an option for test­ing probabilities.


If you have a data table with a col­umn for your pro­por­tion then you can pro­ceed straight to the dis­tri­b­u­tion plat­form. If not then first cre­ate a sum­mary table with two columns. The first col­umn would be your out­come such as Y/N or 0/1 and the he sec­ond col­umn would be your fre­quency col­umn of how many of each out­come you observed.

Test­ing of a proportion:

1. With a col­umn of out­comes: First make sure that your col­umn is of the nom­i­nal type. Sec­ond, use the dis­tri­b­u­tion plat­form to cre­ate a dis­tri­b­u­tion of the out­come. Under the red tri­an­gle drop down menu select “Test Prob­a­bil­i­ties” and a dia­log box will appear with var­i­ous options for test­ing your prob­a­bil­i­ties. Note, you need only fill in the one prob­a­bil­ity that you are inter­ested in testing.

2. With a sum­mary table for your out­comes: Again, make sure that your out­come col­umn is of the nom­i­nal type. Sec­ond, use the dis­tri­b­u­tion plat­form with your out­come col­umn as the Y and the fre­quency col­umn as the “Freq”. Then con­tinue as above by select­ing the test prob­a­bil­i­ties from the red tri­an­gle menu.

Note that you will also find con­fi­dence inter­vals for your pro­por­tions in the red drop down menu.

Boul­der Sta­tis­tics LLC and Global Prag­mat­ica LLC are strate­gic allies, pair­ing Boul­der Sta­tis­tics’ ana­lyt­i­cal exper­tise with Global Pragmatica’s JMP script­ing exper­tise to deliver out­stand­ing solu­tions to our clients. When I saw Karen’s expla­na­tion, I imme­di­ately thought this would be a great oppor­tu­nity to col­lab­o­rate with her and build a JSL wid­get to make this easier.

This script is the result, and Global Prag­mat­ica and Boul­der Sta­tis­tics are proud to make it avail­able free, in an encrypted (run-only) script you can down­load today.

How to use One Pro­por­tion Test

You must license or down­load a demo copy of JMP soft­ware from SAS to use this JMP add-on script.

Launch the script. You are asked to choose a data table, which can be set up either of the two ways Dr. Copeland describes above. A dia­log box requests the nec­es­sary col­umn assign­ments. Click OK. At the bot­tom, fill in the details of the One Pro­por­tion Test. Use the Start Over but­ton to restart the analy­sis with a dif­fer­ent data table. For fur­ther help, see text at the top of the win­dow and tooltips when hov­er­ing over buttons.

How encrypted scripts work (the free widget)

Encrypted scripts are run-only scripts. They are not human-readable, so you can’t mod­ify them or adapt them for other pur­poses. If you would like to study the JSL, mod­ify, or adapt the script, you should license the unen­crypted ver­sion of this script instead.

Why pay for the unen­crypted script?

Don’t! At least not right away… Start by “buy­ing” the free wid­get. Try it out and see if you like it!

If you do, you might want to buy the full-price unen­crypted script, so that you can mod­ify, cus­tomize, or adapt the script for your own spe­cial­ized needs, or so you can study a professional-quality script! This script demon­strates quite a few advanced script­ing tech­niques, including:

  • build­ing an ele­gant, all-in-one-window user inter­face using dis­play objects
  • attach­ing scripts to but­tons, radio but­tons, col­umn lists, etc.
  • includ­ing a cus­tom logo graphic
  • imple­ment­ing a dif­fer­ent dia­log box accord­ing to the user’s radio but­ton choice
  • open­ing, clos­ing, and delet­ing dis­play tree ele­ments dynamically
  • offer­ing tips and help right in the window
  • includ­ing email and web links for more infor­ma­tion, send­ing feed­back, etc.
  • hid­ing globals—whether to pro­tect intel­lec­tual prop­erty or to avoid clut­ter­ing up Show Globals() output
  • opti­miz­ing mem­ory man­age­ment and sim­pli­fy­ing between-use value-clearing by stor­ing problem-specific “glob­als” as entries in an Associative Array() instead of in globals

You can read more about encrypted vs. unen­crypted scripts offered by Global Prag­mat­ica here.


One Pro­por­tion Test has been tested on JMP 8 for Mac and Win­dows as well as cur­rent beta ver­sions of JMP 9 for Mac and Windows.

Known issues

  • In the sec­ond (no longer cur­rent) early adopter release of JMP 9 for Win­dows, you have to start the script man­u­ally. (This is not a prob­lem in JMP 8 or later beta releases of JMP 9.) There are sev­eral ways to do this:
    • press Ctrl-R, or
    • click the Run Script but­ton in the tool­bar, or
    • from the Edit menu, select Run Script

Buy now!

Run-only wid­get: $0.99
Editable script: $500.00

Note: be sure to choose either the $0 (wid­get) or $500 (script) option in the combo-box. For $0 orders, you can use the “No pay­ment needed” pay­ment method; for orders over $0, please use Google Check­out, a secure pay­ment gate­way for pur­chas­ing by credit card.

3 Comments :, more...

Iterative Regression script

by on Feb.09, 2010 , under scripts

Iter­a­tive Regres­sion” is a script that Global Prag­mat­ica LLC® devel­oped for Ron Tana­sichuk of the Cana­dian Depart­ment of Fish­eries and Oceans, imple­ment­ing his own inter­a­tive regres­sion tech­nique. Per­form­ing the analy­sis is by hand is cum­ber­some and extremely slow and cum­ber­some. Automat­ing the analy­sis reduces the pro­cess­ing time from weeks to min­utes and elim­i­nates the human error.

The method:

  1. for a sin­gle Y response and mul­ti­ple X fac­tors, fit all pos­si­ble mod­els hav­ing one and two fac­tors (no interactions)
  2. for each model, exclude any out­liers, and refit the model
  3. repeat fit­ting and exclud­ing until there are no out­liers for the model
  4. save the results from that model
  5. re-include all rows (unex­clude all rows) and begin again with the next fac­tor combination

Out­liers are defined as rows where Abs(Studentized resid­u­als > 2.5) AND (Y-hats > 4/n).

The script is com­pat­i­ble with JMP 7, 8, and 9 and has been thor­oughly tested on Mac ver­sions JMP 7, 8, and 9. A ver­sion tested on Win­dows as well will be avail­able shortly.

Buy now!

Editable script: $1,000.00

Leave a Comment more...


Global Pragmatica’s art­work includes paint­ings by Zsuzsi Saper and dig­i­tal pho­tographs by Erin Vang. Fur­ther notes on spe­cific pieces of art are given at the bot­tom of pages in which they appear. All art­work is copy­right 2009–2010 by Global Prag­mat­ica LLC®. All rights reserved worldwide.

© 2009-10 Global Pragmatica LLC®

All con­tent © 2009-10 by Global Prag­mat­ica LLC®. All rights reserved worldwide.

Global Prag­mat­ica LLC® is a reg­is­tered trade­mark of Global Prag­mat­ica LLC. The ® sym­bol indi­cates USA trade­mark registration.

Contact Global Pragmatica LLC®
+1 415.997.9671
Oak­land, CA 94611