returns a string containing the name of the series. It does not return the series itself. When you write an expression involving a series, you write the actual series, not a string containing the series name. I know that sounds subtle, but essentially what you are doing is:
Code: Select all
@pca("q"+"SERIESA") * "SERIESA"(-1)
where you want to be doing:
Note the quotes in the first one around the series name (since it is a string).
There are a couple of ways to fix this. The most general is with the following:
Code: Select all
for !x = 1 TO data.@count
%name1 = data.@seriesname(!x)
%name2 = "Q" + %name1
SERIES laspq = laspq + (@pca({%name2}) * {%name1}(-1) / aggregate(-1))
next
where I am storing the name of the series in a program variable, %name, and then using { } to de-reference that name (i.e., in very simple terms, remove the quotes).
Note if you had another group with the Q variables in it, you can probably just avoid using the name of the series at all:
Code: Select all
for !x = 1 TO data.@count
SERIES laspq = laspq + (@pca(qdata(!x)) * data(!x)(-1) / aggregate(-1))
next
Where you can use group(!i) to refer to the ith series in a group.