On Fri, 15 May 2009, Giuseppe Vittucci wrote:
I need to extract selected data from different vectors and insert
them
in a variable of the panel.
I wrote this simple program, but it does not work:
loop i=1995..2005
y = $i-1994
o = 1
loop foreach j 5 6 8 22 23 27 28 29 35 40 42 44 45 56 67 73 74 76 84 85
genr Sd[o:y] = RD$i[$j,1]
o++
endloop
endloop
The problem is that I cannot use the variables y and o I defined like
the index variables of the loops (i and j) in the command Sd[o:y] (or
Sd[$o:$y]).
Is there any way to make the script work?
Yes, you can use a string variable in the inner loop:
string obsstr
...
loop foreach j 5 6 8 ...
sprintf obsstr "%d:%d", o, y
Sd[@obsstr] = RD$i[j,1]
o++
endloop
Allin Cottrell