Path variables are shortcuts to directories or files. Rather than enter the entire path to the directory or file, you use the path variable in a JSL script. A path variable is a special type of string and is always contained within double quotation marks.
One common predefined path variable in JMP is $SAMPLE_DATA. This variable points to the sample data folder in your JMP or JMP Pro installation folder. The following example opens the Big Class.jmp sample data table.
Open( "$SAMPLE_DATA/Big Class.jmp" );
Several path variables are predefined in JMP. The following table shows the definitions for the current JMP version. Variables in previous versions of JMP might differ.
Variable |
Path |
---|---|
ADDIN_HOME(com.your.addin.id) Defines the folder where the specified add-in is stored. |
Add-In Builder stores the specified add-in in the following folders, based on your operating system: • Windows: C:\Users\<username>\AppData\Roaming\SAS\JMP\Addins\ • macOS: /Users/<username>/Library/Application Support/JMP/Addins/ For example, Convert File Path( $ADDIN_HOME(com.your.addin.id) evaluates to the location of the com.your.addin.id add-in. To install your add-ins in a shared network location, use the Register Addin() function. See Register an Add-In Using JSL. |
ALL_HOME Defines a folder that can be accessed by all users on a machine. |
• Windows (JMP): C:\ProgramData\SAS\JMP\17\ • Windows (JMP Pro): C:\ProgramData\SAS\JMPPro\17\ • macOS: /Library/Application Support/JMP/17/ To see if the directory exists, run the script Is Directory("$ALL_HOME");. If the folder exists, 1 is returned. |
BUILTIN_SCRIPTS |
• Windows (JMP): C:\Program Files/SAS/JMP/17/Resources/Builtins/ • Windows (JMP Pro): C:\Program Files/SAS/JMPPRO/17/Resources/Builtins/ • macOS: /Applications/JMP 17.app/Contents/Resources/Builtins/ |
DESKTOP |
• Windows: C:\Users\<username>\Desktop\ • macOS /Users/<username>/Desktop/ |
DOCUMENTS |
• Windows: C:\Users\<username>\Documents\ • macOS: /Users/<username>/Documents/ |
DOWNLOADS |
• Windows: C:\Users\<username>\Downloads\ • macOS: /Users/<username>/Downloads/ |
GENOMICS_HOME |
/<JMP Genomics installation directory>/ |
HOME |
• Windows (JMP): C:\Users\<username>\AppData\Roaming\SAS\JMP\17 • Windows (JMP Pro): C:\Users\<username>\AppData\Roaming\SAS\JMPPro\17\ • macOS: /Users/<username>/ |
JMP_HOME |
• Windows: C:\<JMP installation directory> Note: The variable is not available on macOS. |
SAMPLE_APPS |
• Windows: C:\<JMP installation directory>\Samples\Apps\ • macOS: /Library/Application Support/JMP/17/Samples/Apps/ |
SAMPLE_DASHBOARDS |
• Windows: C:\<JMP installation directory>\Samples\Dashboards\ • macOS: /Library/Application Support/JMP/17/Samples/Dashboards/ |
SAMPLE_DATA |
• Windows: C:\<JMP installation directory>\Samples\Data\ • macOS: /Library/Application Support/JMP/17/Samples/Data/ |
SAMPLE_IMAGES |
• Windows: C:\<JMP installation directory>\Samples\Images\ • macOS /Library/Application Support/JMP/17/Samples/Images/ |
SAMPLE_IMPORT_DATA |
• Windows: C:\<JMP installation directory>\Samples\Import Data/ • macOS: /Library/Application Support/JMP/17/Samples/Import Data/ |
SAMPLE_PROJECTS |
• Windows: C:\<JMP installation directory>\Samples\Projects\ • macOS: /Library/Application Support/JMP/17/Samples/Projects/ |
SAMPLE_SCRIPTS |
• Windows: C:\<JMP installation directory>\Samples\Scripts\ • macOS: /Library/Application Support/JMP/17/Samples/Scripts/ |
TEMP |
• Windows: C:\Users\<username>\AppData\Local\Temp\ • macOS: var/folders/... |
USER_APPDATA Changes to JMP preferences, menus, and the Home Window are stored here, along with Debugger session settings. |
• Windows (JMP): C:\Users\<username>\AppData\Roaming\SAS\JMP\17\ • Windows (JMP Pro): C:\Users\<username>\AppData\Roaming\SAS\JMPPro\17\ • macOS: /Users/<username>/Library/Application Support/JMP/17/ |
Path variable definitions are updated automatically based on the version of JMP you are using. For example, when you run a JMP 14 script in JMP 17, the JMP 17 path variable definitions are used.
To see the definition of any path variable, use the function Get Path Variable:
Get Path Variable( "HOME" );
"/C:/Users/<username>/AppData/Roaming/SAS/JMP/17/"
Note that you don’t include a dollar sign for Set Path Variable() or Get Path Variable(). But you must include the dollar sign when using the variable in a script.
Make sure to include a trailing slash after the path variable. In the following example, the root name "Big Class" is assigned to the dtName variable. The Open() expression evaluates $SAMPLE_DATA and the trailing slash and then appends the dtName value along with the file extension .jmp.
dtName = "Big Class";
dt = Open( "$SAMPLE_DATA/" || dtName || ".jmp" );
The path is interpreted as:
C:\Program Files\SAS\JMP\17\Samples\Data\Big Class.jmp
Without the slash that follows $SAMPLE_DATA, the path is interpreted as:
C:\Program Files\SAS\JMP\17\Samples\DataBig Class.jmp