DATA inputVector {inputVector} resultVariable

Replaces the contents of the result variable with the contents of the input vector(s) concatenated in the order of their listing.

In Statistics101, this command has been generalized to allow input of any number and mix of input vectors and/or any kind of literal list, literal sequence, or multiple literal (quantity#value). See Using the Sequence and Multiple Operators.

The following commands are synonyms for the DATA command: COPY, NUMBERS, URN, and CONCAT. They are all identical except for their names. Use whichever name is most meaningful in context.

DATA 1,5 A
DATA (5 6 8 14 20) B
DATA 4#5 C

The above program produces the following output:

A: (1.0 2.0 3.0 4.0 5.0)
B: (5.0 6.0 8.0 14.0 20.0)
C: (5.0 5.0 5.0 5.0)

The next program...

DATA 4,1 (2 3 5) 3#9 2 5 A

...produced this output:

A: (4.0 3.0 2.0 1.0 2.0 3.0 5.0 9.0 9.0 9.0 2.0 5.0)

If you want to concatenate one or more vectors onto the beginning or end of another vector, you would do it like this:

DATA 1,5 A     'original vector
DATA 10,20 A A 'add 10,20 to start of A

DATA A 10,20 A 'add 10,20 to end of A

Here's a practical example: When choosing 2 students at random from a class of 10 boys and 15 girls, what is the probability of their both being girls?

NAME boy girl
DATA 10#boy 15#girl students
COPY 1000 repeatCount
COPY 0 successCount
REPEAT repeatCount
   SAMPLE 2 students winners
   COUNT winners = girl girlCount
   IF girlCount = 2
      ADD 1 successCount successCount
DIVIDE successCount repeatCount probability
PRINT probability

The above program produces the following output:

probability: 0.353