|
GATHERName:
With the GATHER command, we define a separate variable that contains the specific rows we want to extract. If you modify the extracted data and want to save these modified values back to the original variable, you can use the SCATTER command. Enter HELP SCATTER for further information.
where <x> is a response variable; <index> is a variable containing row numbers; and <y> is a variable (of length equal to <index>) that contains the rows of <x> corresponding to <index>.
let n = 30
let xseq = sequence 1 1 n
let x = normal rand numb for i = 1 1 n
let iindex = data 10 14 8 23 19
.
let y = gather x iindex
set write decimals 3
print xseq x iindex y
The following output is generated.
1.000 -1.073 10.000 0.270
2.000 0.573 14.000 -0.841
3.000 -0.873 8.000 0.032
4.000 0.234 23.000 -1.063
5.000 -0.455 19.000 0.034
6.000 -0.525 0.000 0.000
7.000 -0.706 0.000 0.000
8.000 0.032 0.000 0.000
9.000 1.191 0.000 0.000
10.000 0.270 0.000 0.000
11.000 -0.149 0.000 0.000
12.000 -0.197 0.000 0.000
13.000 -0.243 0.000 0.000
14.000 -0.841 0.000 0.000
15.000 -0.104 0.000 0.000
16.000 0.419 0.000 0.000
17.000 0.264 0.000 0.000
18.000 0.898 0.000 0.000
19.000 0.034 0.000 0.000
20.000 1.588 0.000 0.000
21.000 0.389 0.000 0.000
22.000 -0.470 0.000 0.000
23.000 -1.063 0.000 0.000
24.000 -0.027 0.000 0.000
25.000 -0.464 0.000 0.000
26.000 0.592 0.000 0.000
27.000 -0.506 0.000 0.000
28.000 -0.360 0.000 0.000
29.000 0.499 0.000 0.000
30.000 0.243 0.000 0.000
Date created: 12/4/2008 |