cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar

Introduction to Lists

Started ‎11-08-2022 by
Modified ‎11-08-2022 by
View Fullscreen Exit Fullscreen

An important data structure in JMP is a list, which is a general-purpose storage container that can store any number of items. The items can be any type of data such as numbers, character strings, object references, or other lists, and the items in the list don't need to be the same type. You can create a list with the List function, or with the curly brackets operator. Items in a list are separated by commas, and you can store a list in a variable. Your script might also work with lists that are returned by JSL functions. Let's look at a few examples of creating lists. You can create an empty list by using either the List function or the list operator with no items listed inside the parentheses or curly brackets. An empty list is useful if your script will be accumulating items as it runs. You can create a list with a single item, or with multiple items. You can have a list that contains nested lists as one or more of the items, which is useful for branched or nested data. And you can also have a list that contains varied items. After you've created a list, you can refer to specific items within the list using a subscript, which is a value (or values) in square brackets appended to the variable name. For example, given the list shown here, appending square brackets containing the index value of one to the variable my list returns the string "Statistics". The subscript three returns the nested list containing the strings "Florence" and "Gertrude". You can also use multiple subscripts to isolate an item in a nested list or to obtain more than one item from a list. For example, my list subscripted with a three and then a one returns the string "Florence". my list subscripted with a list of index values -- for example, two and four -- returns a sub-list with the second and fourth items: a date and the number respectively.