For the latest version of JMP Help, visit JMP.com/help.

Scripting Guide > Types of Data > Numbers and Strings
Publication date: 09/28/2021

Numbers and Strings

Numbers can be written as integers, decimal numbers, in scientific notation with an E preceding the power of ten, and as date-time values. A single period by itself is the missing numeric value.

For example, these are all numbers:

.   1   12   1.234  3E3  0.314159265E+1 1E-20

One or more characters placed within double quotation marks constitute a string. For example, these are all strings:

"Green" "Hello,\NWorld!" "54"

Notice that if a number is in quotation marks, it is a string, not a number. There are two functions you can use to change a number into a string or a string into a number.

Use Num() to convert a string into a number. For example:

Num( "54" );

54

Note: Num() cannot convert non-numeric characters, so it produces a missing value.

Num( "Hello" );

.

Use Char() to convert a number into a string. For example:

Char( 54 );

"54"

Char( 3E3 )

"3000"

To preserve locale-specific numeric formatting in Num() or Char() output, include the <<Use Locale(1) option as shown in the following example:

Char( 42, 5, 2, << Use Locale( 1 ) );

// results in the character value "42,00" in the French locale

To look at each character in a string, use the Substr() function. This example looks for the letter “a” in the string and prints a message to the log:

ch = Substr( "alphabetic", 1, 1 ); // start and end with the first character
If( ch == "a",
	Print( "First letter is a." )
);

"First letter is a."

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).