sample command

The sample command creates a temporary select-list of the first n items in a file that match the specified criteria. This command is useful when testing a small number of items. For example, testing 100 items in a file rather than the entire file.

The sample command creates a temporary select-list containing the first n item-IDs of the items specified in the item-list or the selection criteria. The items referenced by the select-list are processed by the next command executed.

Only the statement immediately following the sample command has access to the select-list. You must use the select-list immediately or you will lose it.

To permanently save the select-list, use the save-list command. When a select-list is saved, you can retrieve it at any time with the get-list command.

A select-list can reference data in any file, not just the file specified in the original sample statement. If two files have similar items with the same item-IDs, you can create a select-list from one file, then use it to operate on items from the other file.


 ssample [DICT] filename [item-list] [selection] [output] (n)


DICT Specifies the file dictionary.
filename The name of the file.
item-list A list of individual item-IDs that you want to select or compare against specified criteria. Enclose each item-ID in single quotes. This parameter overrides n.
selection Specifies one or more conditions that an item must meet to be included in the select-list. For a complete description of selection expression syntax, see the list command information.
output The name of an attribute whose values are to be selected. Each value becomes a separate item-ID in the select-list.
n The number of items to sample.


The following example creates a select-list containing the first four items in the ORDERS file whose sale date is January 15, 2018:

>SAMPLE ORDERS WITH DATE = "01/15/18" (4)

If you list these items with the list command, they appear in sorted order: