You are previewing JMP 11 Scripting Guide, Second Edition, 2nd Edition.
O'Reilly logo
JMP 11 Scripting Guide, Second Edition, 2nd Edition

Book Description

Scripting Guide provides details for taking advantage of the powerful JMP Scripting Language (JSL). Learn how to write and debug scripts, manipulate data tables, construct display boxes, create JMP applications, and more.

Table of Contents

  1. Contents
  2. Learn about JMP
    1. Documentation and Additional Resources
    2. Formatting Conventions
    3. JMP Documentation
      1. JMP Documentation Library
      2. JMP Help
    4. Additional Resources for Learning JMP
      1. Tutorials
      2. Sample Data Tables
      3. Learn about Statistical and JSL Terms
      4. Learn JMP Tips and Tricks
      5. Tooltips
      6. JMP User Community
      7. JMPer Cable
      8. JMP Books by Users
      9. The JMP Starter Window
  3. Introduction
    1. Welcome to the JMP Scripting Language
    2. What JSL Can Do for You
    3. Help with Learning JSL
      1. The Scripting Guide
      2. The Scripting Index
      3. Let JMP Teach You JSL
    4. Terminology
    5. Basic JSL Syntax
  4. Getting Started
    1. Let JMP Write Your Scripts
    2. Capturing a Script for an Analysis Report
    3. Capturing a Script for a Data Table
    4. Capturing a Script to Import a File
    5. Gluing Scripts Together
  5. Scripting Tools
    1. Using the Script Editor, Log Window, Debugger and Profiler
    2. Using the Script Editor
      1. Run a Script
      2. Color Coding
      3. Auto Complete Functions
      4. Tooltips
      5. Split a Window
      6. Match Parentheses, Brackets, and Braces
      7. Select a Block of Text
      8. Drag and Drop Text
      9. Find and Replace
      10. Automatic Formatting
      11. Add Code Folding Markers
        1. Add More Folding Keywords
      12. Advanced Options
      13. Set Preferences for the Script Editor
    3. Working with the Log
      1. Show the Log in the Script Window
      2. Save the Log
    4. Debug or Profile Scripts
      1. Debugger and Profiler Window
        1. Using the Execution Buttons
        2. Variable Lists
        3. Debugger Options
      2. Work with Breakpoints
        1. Create a Breakpoint
        2. Delete Breakpoints
        3. Disable and Enable Breakpoints
        4. Specify and Clear Conditional Expressions on Breakpoints
        5. Specify Break Options
        6. Run the Script to the Cursor
        7. Tips for Setting Breakpoints
      3. View Variables
        1. Tips for Managing Variables
      4. Work with Watches
      5. Modify Preferences in Debugger
      6. Persistent Debugger Sessions
      7. Examples of Debugging and Profiling Scripts
        1. Using Breakpoints and Watching Global Variables
        2. Stepping Into, Over, and Out
        3. Watching Variables in Different Scopes and Namespaces
        4. Using the Debugger with Interactive Scripts
        5. Using the JSL Profiler
  6. JSL Building Blocks
    1. Learning the Basics of JSL
    2. JSL Syntax Rules
      1. Value Separators
        1. Commas
        2. Parentheses
        3. Semicolons
        4. Double Quotes
        5. Spaces
      2. Numbers
      3. Names
      4. Comments
    3. Operators
    4. Global and Local Variables
      1. Local Namespaces
      2. Named Namespaces
      3. Show Symbols, Clear Symbols, and Delete Symbols
      4. Lock and Unlock Symbols
    5. Rules for Name Resolution
      1. Resolving Unscoped Names
      2. Scoping Operators
        1. Scoped Column Names
        2. Unscoped Column Names
        3. Set the Current Data Table Row
      3. Troubleshooting Variables and Column Names
      4. Troubleshooting Variables and Keywords
      5. Frequently Asked Questions about Name Resolution
    6. Alternatives for Gluing Expressions Together
    7. Iterate
      1. For
      2. While
      3. Summation
      4. Product
      5. Break and Continue
        1. Break
        2. Continue
    8. Conditional Functions
      1. If
      2. Match
      3. Choose
      4. Interpolate
      5. Step
    9. Compare Incomplete or Mismatched Data
      1. Missing Numeric Values
      2. Missing Character Values
    10. Inquiry Functions
      1. General Element Types
      2. Specific Element Types
      3. Object Attributes
      4. Host Information
      5. Version Information
  7. Types of Data
    1. Working with Numbers, Strings, Dates, Currency, and More
    2. Numbers and Strings
      1. Unicode Characters
    3. Path Variables
      1. Create and Customize Path Variables
      2. Relative Paths
      3. File Path Separators
    4. Date-Time Functions and Formats
      1. Date-Time Values
      2. Program with Date-Time Functions
        1. Examples of Common Date-Time Functions
        2. Extract Parts of Dates
        3. Arithmetic on Dates
        4. Time Intervals
        5. Two- and Four-Digit Years
      3. Date-Time Values in Data Tables
        1. Change Date-Time Input and Display Formats
    5. Currency
    6. Hexadecimal and BLOB Functions
    7. Work with Character Functions
      1. Concat
      2. Munger
      3. Repeat
    8. Use Pattern Matching and Regular Expressions
      1. Patterns and Case
      2. Regular Expressions
  8. Data Structures
    1. Working with Collections of Data
    2. Lists
      1. Evaluate Lists
      2. Assignments with Lists
      3. Perform Operations in Lists
      4. Find the Number of Items in a List
      5. Subscripts
      6. Locate Items in a List
      7. List Operators
      8. Iterate through a List
      9. Concatenate Lists
    3. Matrices
      1. Construct Matrices
        1. Construct Matrices from Lists
        2. Construct Matrices from Expressions
      2. Subscripts
        1. Single Element
        2. Matrix or List Subscripts
        3. Single Subscripts
        4. Delete Rows and Columns
        5. Select Whole Rows or Columns
        6. Assignment through Subscripts
        7. Operator Assignment
        8. Ranges of Rows or Columns
      3. Inquiry Functions
      4. Comparisons, Range Checks, and Logical Operators
      5. Numeric Operations
        1. Basic Arithmetic
        2. Numeric (Scalar) Functions on Matrices
      6. Concatenation
      7. Transpose
      8. Matrices and Data Tables
        1. Move Data into a Matrix from a Data Table
        2. Move Data into a Data Table from a Matrix
        3. Summarize Columns
      9. Matrices and Reports
      10. Loc Functions
        1. Loc()
        2. Loc Nonmissing()
        3. Loc Min() and Loc Max()
        4. Loc Sorted()
      11. Ranking and Sorting
      12. Special Matrices
        1. Construct an Identity Matrix
        2. Construct a Matrix with Specific Values
        3. Create a Diagonal Matrix
        4. Create a Column Vector from Diagonal Elements
        5. Calculate Diagonal Quadratic Forms
        6. Return the Sum of Diagonal Elements
        7. Generate a Row Vector of Integers
        8. Reshape a Matrix
        9. Create Design Matrices
        10. Find the Direct Product
      13. Inverse Matrices and Linear Systems
        1. Inverse or Inv
        2. GInverse
        3. Solve
        4. Sweep
        5. Determinant
      14. Decompositions and Normalizations
        1. Eigenvalues
        2. Cholesky Decomposition
        3. Singular Value Decomposition
        4. Orthonormalization
        5. Orthogonal Polynomials
        6. QR Decomposition
        7. Update Inverse Matrices
      15. Build Your Own Matrix Operators
      16. Statistical Examples
        1. Regression Example
        2. ANOVA Example
    4. Associative Arrays
      1. Create Associative Arrays
      2. Work with Associative Arrays
        1. Find the Number of Keys
        2. Add and Delete Keys and Values
        3. Find Keys or Values in an Associative Array
        4. Iterate through an Associative Array
      3. Applications for Associative Arrays
      4. Associative Arrays in Graph Theory
      5. Associative Arrays in Set Operations
  9. Programming Methods
    1. Complex Scripting Techniques and Additional Functions
    2. Lists and Expressions
      1. Stored expressions
        1. Quoting and unquoting expressions
        2. Quote an expression as a string
        3. Store scripts in global variables
        4. Retrieve a stored expression, not its result
        5. Making lots of substitutions
        6. Evaluate expressions inside lists
        7. Evaluate expressions inside expressions
        8. Parsing strings into expressions, and vice versa
        9. Summary
      2. Macros
      3. Manipulating lists
        1. In-place operators
        2. Not in-place operators
        3. Substituting
      4. Manipulating expressions
        1. Substituting
    3. Advanced Scoping and Namespaces
      1. Names Default To Here
        1. Handling Unqualified Named Variable References
        2. Names Default To Here and Global Variables
        3. Example of Using the Names Default To Here() Function
      2. Scoped Names
        1. Predefined Scopes
        2. Example of Using the Window Scope
        3. Example of Using the Here Scope
      3. Namespaces
        1. User-Defined Namespace Functions
        2. Namespace Messages
        3. Using Namespace References
        4. Namespaces and Included Scripts
        5. Examples of User-Defined Namespaces
      4. Referencing Namespaces and Scopes
      5. Resolving Named Variable References
      6. Best Practices for Advanced Scripting
    4. Advanced Programming Concepts
      1. Throwing and Catching Exceptions
      2. Functions
      3. Recursion
      4. Includes
      5. Loading and Saving Text Files
    5. Scripting BY Groups
    6. Organize Files into Projects
    7. Encrypt and Decrypt Scripts
      1. Encryption and Global Variables
      2. Encrypting Scripts in Data Tables
    8. Additional Numeric Operators
      1. Derivatives
      2. Algebraic Manipulations
      3. Maximize and Minimize
        1. Least Squares Example
    9. Scheduling Actions
    10. Functions that Communicate with Users
      1. Writing to the Log
        1. Show
        2. Print
        3. Write
      2. Send information to the User
        1. Beep
        2. Speak
        3. Caption
        4. StatusMsg
        5. Mail
  10. Data Tables
    1. Working with Data Table Objects
    2. Get Started
    3. Basic Data Table Scripting
      1. Open a Data Table
        1. Test for an Open Data Table
        2. Prompt Users to Open a Data Table
        3. Show Only Specific Columns
      2. Create a New Data Table
      3. Import Data
        1. Import Data from a Text File
        2. Import Data from a Microsoft Excel File
        3. Import SAS Data Sets
        4. Import Web Pages and Remote Files
        5. Import ESRI Shapefiles
        6. Import a Password-Protected Excel File
        7. Import a Database
      4. Set the Current Data Table
      5. Name a Data Table
      6. Save a Data Table
      7. Hide a Data Table
      8. Print a Data Table
      9. Resize a Data Table
      10. Close a Data Table
      11. Set and Get a Data Table
      12. Perform Actions on All Open Data Tables
      13. Create Journals and Layouts
    4. Advanced Data Table Scripting
      1. Store Summary Statistics in Global Variables
      2. Create a Table of Summary Statistics
      3. Subset a Data Table
        1. Subset Data Using the Data Filter
        2. Define the Context of a Data Filter
      4. Sort a Data Table
      5. Stack Values in a Data Table
      6. Split Values in a Stacked Data Table
      7. Transpose a Data Table
      8. Vertically Concatenate Data Tables
      9. Horizontally Concatenate Data Tables
      10. Replace Data in Data Tables
      11. Create a Table Using Tabulate
      12. Find Missing Data Patterns
      13. Compare Data Tables
      14. Subscribe to a Data Table
      15. Move Data Between Matrices and Data Tables
    5. Columns
      1. Send Messages to Data Column Objects
      2. Create Columns
      3. Add Several Columns at Once
      4. Group Columns
        1. Get Column Groups or Names
        2. Select a Column Group
        3. Rename a Column Group
        4. Move a Column Group
      5. Select Columns
      6. Rearrange and Move Columns
      7. Add a Column Switcher
      8. Compress Selected Columns
      9. Delete Columns
      10. Obtain Column Names
      11. Column Attributes
        1. Set or Get a Column Name
        2. Set or Get Column Values
        3. Set or Get Value Labels
        4. Set or Get Data and Modeling Types
        5. Set or Get Formats
        6. Set, Get, or Evaluate a Formula
        7. Set and Get Range and List Checks
        8. Get a Column Script
        9. Preselect Roles
        10. Lock a Column
      12. Column Properties
    6. Rows
      1. Add Rows
      2. Delete Rows
      3. Select Rows
      4. Find Rows
      5. Move Rows
      6. Assign Colors and Markers to Rows
      7. Color Cells
      8. Hide, Exclude, and Label Rows
      9. Iterate on Rows in a Table
        1. Set the Current Row
        2. What is the Current Row?
        3. How Many Rows and Columns?
        4. Iterate a Script on Each Row
        5. Return Row Values
        6. Add Sequence Data
      10. Row States and Operators
        1. About Row States
        2. About Row State Operators
        3. Assign Row States
        4. Store Row State Information
        5. Set or Get Row States
        6. Identify Row State Changes
        7. Exclude, Hide, Label, and Select
        8. Colors and Markers
        9. The Numbers behind Row States
    7. Accessing Data Values
      1. Set or Get Values by Column Name
      2. Additional Ways to Access Data Values
    8. Add Metadata to a Data Table
      1. Table Variables
      2. Table Scripts
      3. Formulas
      4. Delete Metadata
    9. Calculations
      1. Pre-Evaluated Statistics
        1. Columnwise Functions
        2. Rowwise Functions
      2. Calculator Formulas
  11. Scripting Platforms
    1. Create, Repeat, and Modify Analyses
    2. Overview
    3. Scripting Analysis Platforms
    4. Launching Platforms Interactively and Obtaining the Equivalent Script
      1. Launch a Platform
      2. Save Script
      3. Make Some Changes
      4. Syntax for Platform Scripting
      5. BY Group Reports
      6. Saving BY Group Scripts
    5. Sending Script Commands to a Live Analysis
      1. Conventions for Commands and Arguments
      2. Sending Several Messages
      3. Learning the Messages an Object Responds to
      4. How to Interpret the Listing from Show Properties
    6. Launching Platforms
      1. Specifying Columns
      2. Platform Action Command
      3. Invisible Reports
      4. Titles
    7. General Messages for Platform Windows
      1. Options for All Platforms
        1. By
        2. Title
        3. Axes
        4. Automatic Recalculation
    8. Additional Notes
      1. Spline Fits
      2. Fit Model Effects
      3. Fit Model Send Command
      4. DOE Scripting
        1. Tuning Commands
      5. Scatterplot Scripting
      6. Control Charts
        1. Running Alarm Scripts
        2. Example: X - and R-Charts
        3. Example: X - and S-charts with Varying Subgroup Sizes
        4. Example: Individual Measurement and Moving Range Charts
        5. Example: UWMA Charts
        6. Example: EWMA Charts
        7. Example: NP-Charts
        8. Example: P-Charts
        9. Example: U-Charts
        10. Example: C-Charts
        11. Phases
  12. Display Trees
    1. Create and Use Windows
    2. Manipulating Displays
      1. Introduction to Display Boxes
        1. View Display Tree
      2. Display Box Object References
        1. By Subscript
        2. Wildcards
      3. Sending Messages
        1. Learning What You Can Do with a Display Box
        2. Using the << Operator
        3. Nesting and Precedence
        4. Find a Window Quickly
        5. Customizing Reports
        6. Platform Example JSL
        7. Set Function and Set Script
        8. Window
    3. How to Access Built-in Windows
      1. Using the Pick Windows
      2. Files in Directory
    4. Constructing Display Trees
      1. Basics
        1. Example
      2. Updating an Existing Display
        1. Append
        2. Prepend
        3. Delete
        4. Sib Append
        5. Updating a Numeric Column
        6. Updating a String Column
        7. Controlling Text Wrap
        8. Bullet Points in Text Boxes
      3. Interactive Display Elements
        1. Slider Box
        2. Range Slider Box
        3. Button Box
        4. Global Box
        5. Examples
      4. Modal and Non-Modal Windows
        1. Border Box
        2. Button Box
        3. Check Box
        4. Col List Box
        5. Col Span Box
        6. Combo Box
        7. Journal Box
        8. Line Up Box
        9. List Box
        10. Number Col Edit Box
        11. Number Edit Box
        12. Panel Box
        13. Popup Box
        14. Radio Box
        15. Slider Box
        16. String Col Edit Box
        17. Tab Box
        18. Text Box
        19. Text Edit Box
      5. Complete Example
        1. Examples of Getting and Setting Values of Interactive Display Elements
        2. Advanced Example
      6. Send Messages to Constructed Displays
      7. Build Your Own Displays from Scratch
      8. Construct Display Boxes Containing Platforms
      9. Construct a Custom Platform
      10. Sheets
      11. Journals
      12. Picture Display Type
    5. Modal Windows
      1. Constructing Modal Windows
      2. General-Purpose Modal Window
      3. Convert Deprecated Dialog to New Window
        1. Strings and Lists
        2. List Boxes and Check Boxes
        3. Arranging Items
        4. Radio Boxes
        5. Editable Text Boxes
        6. Editable Number Boxes
        7. Adding Optional Scripts
      4. Comparison of Dialog and New Window
        1. Extracting Values
      5. Data Columns
        1. Assign Dialogs to Variables
        2. Unload Results
      6. Constructing Dialogs and Column Dialogs
    6. Scripting the Script Editor
    7. Syntax Reference
  13. Scripting Graphs
    1. Create and Edit 2-Dimensional Plots
    2. Adding Scripts to Graphs
      1. Ordering Graphics Elements Using JSL
    3. Adding a Legend to a Graph
    4. Creating New Graphs From Scratch
      1. Making Changes to Graphs
    5. Graphing Elements
      1. Plotting Functions
        1. Gradient Function
      2. Getting the Properties of a Graphics Frame
      3. Adding a Legend
    6. Drawing Lines, Arrows, Points, and Shapes
      1. Lines
      2. Arrows
      3. Markers
      4. Pies and Arcs
      5. Regular Shapes: Circles, Rectangles, and Ovals
        1. Circles
        2. Rectangles
        3. Ovals
      6. Irregular Shapes: Polygons and Contours
        1. Polygons
        2. Contours
      7. Adding text
      8. Colors
      9. Transparency
      10. Fill patterns
      11. Line types
      12. Drawing With Pixels
    7. Interactive graphs
      1. Handle
      2. MouseTrap
      3. Drag Functions
      4. Troubleshooting
  14. Three-Dimensional Scenes
    1. Scripting in Three Dimensions
    2. About JSL 3-D Scenes
    3. JSL 3-D Scene Boxes
    4. Setting the Viewing Space
      1. Setting Up a Perspective Scene
      2. Setting up an Orthographic Scene
    5. Changing the View
      1. The Translate Command
      2. The Rotate Command
      3. The Look At Command
      4. The ArcBall
    6. Graphics Primitives
      1. Primitives Example
      2. Controlling the Appearance of Primitives
        1. Size and Width
        2. Stippling Pattern
        3. Fill Pattern
      3. Other uses of Begin and End
    7. Drawing Spheres, Cylinders, and Disks
      1. Construction
        1. Cylinders
        2. Disks
        3. Spheres
      2. Lighting
    8. Drawing Text
      1. Using Text with Rotate and Translate
    9. Using the Matrix Stack
    10. Lighting and Normals
      1. Creating Light Sources
      2. Lighting Models
      3. Normal Vectors
      4. Shading Model
      5. Material Properties
      6. Alpha Blending
      7. Fog
      8. Example
    11. B├ęzier Curves
      1. One-Dimensional Evaluators
      2. Two-Dimensional Evaluators
    12. Using the mouse
      1. Pick Commands
    13. Arguments
  15. Extending JMP
    1. External Data Sources, Analytical Tools, and Automation
    2. Real-Time Data Capture
      1. Create a Datafeed Object
        1. Options
      2. Read in Real-Time Data
      3. Manage a Datafeed with Messages
      4. Examples of Datafeed
        1. Reading Data
        2. Set Up a Live Control Chart
        3. Store the Script in a Data Table
    3. Dynamic Link Libraries (DLLs)
    4. Using Sockets in JSL
      1. Socket-Related Commands
      2. Messages for Sockets
    5. Database Access
      1. Additional Database Commands
    6. Working with SAS
      1. Make a SAS DATA Step
      2. Create SAS DATA Step Code for Formula Columns
      3. SAS Variable Names
      4. Get the Values of SAS Macro Variables
      5. Connect to a SAS Metadata Server on Windows
        1. Make the Connection
        2. Automatically Connect SAS Libraries
        3. View SAS Libraries
        4. Open SAS Data Sets
        5. Save SAS Data Sets
        6. Run a Stored Process
        7. Submit SAS Code from JMP
      6. Preferences
      7. Sample Scripts
    7. Working with MATLAB
      1. Installing MATLAB
        1. Install MATLAB on Windows
        2. Install MATLAB on Macintosh
        3. How JMP Finds MATLAB
        4. Test Your Install
    8. Working with R
      1. Installing R
        1. Override Default R Install Location
        2. How JMP Finds R
        3. Testing Your Setup
      2. JMP to R Interfaces
      3. R JSL Scriptable Object Interfaces
      4. Conversion Between JMP Data Types and R Data Types
        1. JMP Scoping Operators and R
        2. Using R Name() with R Send()
      5. Troubleshooting
        1. Recording Output
        2. Character Vectors
        3. Element Names
      6. Examples
        1. Sending a Data Table to R
        2. Creating Objects in R
        3. Using R Functions and Graphics
        4. Simple Matrix Addition in R
        5. A Bootstrap Sample
    9. Working with Excel
    10. OLE Automation
      1. Automating JMP through Visual Basic
        1. Starting a JMP Application
        2. Launching an Analysis
        3. Creating and Populating a Data Table
        4. Example Programs
        5. An Example: Automating JMP From Excel 2007
      2. Automating JMP through Visual C++
        1. Steps for Automating JMP
        2. Example Program
  16. Creating and Sharing Applications
    1. Application Builder and Add-In Builder
    2. Application Builder
      1. Example
      2. Application Builder Terminology
      3. Design an Application
      4. Application Builder Window
      5. Red Triangle Options
      6. Create an Application
        1. Create a New Application
        2. Manage Modules
        3. Modal Dialog Modules
        4. Arrange and Remove Objects
        5. Customize Object Properties
        6. Write Scripts
      7. Edit or Run an Application
      8. Options for Saving Applications
      9. Additional Examples
        1. Parameterized Variables
        2. Date Selector
    3. JMP Add-Ins
      1. Create an Add-In Using Add-In Builder
      2. Edit an Add-In
      3. Remove an Add-In from the Add-Ins Menu
      4. Uninstall an Add-In
      5. Share an Add-In
      6. Installing Multiple Add-Ins
      7. Register an Add-In Using JSL
      8. Create an Add-In Manually
        1. Example of a addin.def File
        2. Example of a JMP Add-In
  17. Common Tasks
    1. Getting Started with Sample Scripts
    2. Running a Script at Start Up
    3. Convert Character Dates to Numeric Dates
    4. Format Date/Time Values and Subset Data
    5. Create a Formula Column
    6. Extract Values from an Analysis into a Report
    7. Create an Interactive Program
  18. Compatibility Notes
    1. Changes in Scripting from JMP 10 to JMP 11
  19. Glossary
    1. Terms, Concepts, and Placeholders
  20. Index
    1. Scripting Guide
    2. Symbols
    3. A
    4. B
    5. C
    6. D
    7. E
    8. F
    9. G
    10. H
    11. I
    12. J
    13. L
    14. M
    15. N
    16. O
    17. P
    18. Q
    19. R
    20. S
    21. T
    22. U
    23. V
    24. W-Z