Scripting Guide > Types of Data > Path Variables
发布日期: 04/13/2021

Path Variables

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 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.

Table 6.1 Predefined Path Variable Definitions 

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 in the Creating Applications.

ALL_HOME

Defines a folder that can be accessed by all users on a machine.

Windows (JMP): "/C:/ProgramData/SAS/JMP/<version number>/"

Windows (JMP Pro): "/C:/ProgramData/SAS/JMPPro/<version number>/"

macOS: "/Library/Application Support/JMP/<version number>/"

To see if the directory exists, run the script Is Directory("$ALL_HOME");. If the folder exists, 1 is returned.

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/<version number>/"

Windows (JMP Pro): "/C:/Users/<username>/AppData/Roaming/SAS/JMPPro/<version number>/"

macOS: "/Users/<username>/"

JMP_HOME

Windows: /C:/<JMP installation directory>

macOS: "/Library/Application Support/<JMP installation directory>/JMP.app/Contents/Resources/AddIns/

Note: The macOS path exists only if add-ins are installed.

SAMPLE_APPS

Windows: /C:/<JMP installation directory>/Samples/Apps/"

macOS: "/Library/Application Support/<JMP installation directory>/Samples/Apps/"

SAMPLE_DASHBOARDS

Windows: /C:/<JMP installation directory>/Samples/Dashboards/"

macOS: "/Library/Application Support/<JMP installation directory>/Samples/Dashboards/"

SAMPLE_DATA

Windows: "/C:/<JMP installation directory>/Samples/Data/"

macOS: "/Library/Application Support/<JMP installation directory>/Samples/Data/"

SAMPLE_IMAGES

Windows: "/C:/<JMP installation directory>/Samples/Images/"

macOS: "/Library/Application Support/<JMP installation directory>/Samples/Images/"

SAMPLE_IMPORT_DATA

Windows: "/C:/<JMP installation directory>/Samples/Import Data/"

macOS: "/Library/Application Support/<JMP installation directory>/Samples/Import Data/"

SAMPLE_PROJECTS

Windows: "/C:/<JMP installation directory>/Samples/Projects/"

macOS: "/Library/Application Support/<JMP installation directory>/Samples/Projects/"

SAMPLE_SCRIPTS

Windows: "/C:/<JMP installation directory>/Samples/Scripts/"

macOS: "/Library/Application Support/<JMP installation directory>/Samples/Scripts/"

TEMP

Windows: "/C:/Users/<username>/AppData/Local/Temp/"

macOS: "/private/var/folders/.../Temporary Items/"

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/<version number>/"

Windows (JMP Pro): "/C:/Users/<username>/AppData/Roaming/SAS/JMPPro/<version number>/"

macOS: "/Users/<username>/Library/Application Support/JMP/<version number>/"

Path variable definitions are updated automatically based on the version of JMP you are using. For example, when you run a JMP 9 script in JMP 12, the JMP 12 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/15/"

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.

Trailing Slashes

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/15/Samples/Data/Big Class.jmp

Without the slash that follows $SAMPLE_DATA, the path is interpreted as:

C:/Program Files/SAS/JMP/15/Samples/DataBig Class.jmp
需要更多信息?有问题?从 JMP 用户社区得到解答 (community.jmp.com).