On Tue, 18 Dec 2018, Artur T. wrote:
Just one question for clarification. Running the following yields an
--
at least for me -- unexpected behaviour where series foo results in a
constant ("Entry_c") even though S[i] is different for each i.
<hansl>
nulldata 14000
series foo = 1 # SET to 1
strings S = array($nobs)
loop i=1..$nobs -q
S[$i] = sprintf("Entry_%d", $i)
endloop
stringify(foo,S)
print S # results in "Entry_1" for all obs
series foo = 2 # SET to 2
strings S = array($nobs)
loop i=1..$nobs -q
S[$i] = sprintf("Entry_%d", $i)
endloop
print S # results in "Entry_2" for all obs
</hansl>
Shouldn't really be unexpected.
Per stringify(), the strings from array @S are used only as needed
to encode the values of the series in question. Since the series you
define have only one value each (i.e. they are constant) they
require only one string, namely S[1].
Excess elements in the array of strings are tolerated, though if the
number of strings is deficient that provokes an error.
BTW, better not to use "$i" when "i" will do just fine. You need
"$i" only when you want the index value as a string, which is not
the case here.
Allin