I would like to generate a series of variables within a loop. Let's say I need to create five variables var_1, var_2, ..., var_5 as follows:
y=rndn(5,1); for i(1,5,1); var_i=y[i]; endfor;
Of course I cannot use the running index i in "var_i" as it is, but there should be a way for doing this?
You could do the following to set symbol values using run-time string values:
y=rndn(5,1); for i(1,5,1); call varput(y[i], "var_"$+ntos(i)); endfor;
The answer above using
varput is correct. However, there is usually a better way to things in GAUSS. If you can tell a little about what you are trying to do, I may be able to help you come up with a better solution.