Creating sums of series
Creating sums of series
I have a number of series, named sharedkah to sharedkth for the period 2000 to 2016.
I would like to sum the series for each year into a new series , "sumdk", which then would have the sum of all series 2000-2016.
I can do it by matrices but I think there's an easier way.
However, the below didn't work.
sstat / %slike("sharedk*")>>sumdk.
Any suggestions would be greatly appreciated.
I would like to sum the series for each year into a new series , "sumdk", which then would have the sum of all series 2000-2016.
I can do it by matrices but I think there's an easier way.
However, the below didn't work.
sstat / %slike("sharedk*")>>sumdk.
Any suggestions would be greatly appreciated.
Re: Creating sums of series
The SSTATS won't do the implied loop over the series. Assuming I understand you correctly, you would like something like:
compute allsum=0.0
dofor s = %slike("sharedk*")
sstats / s{0}>>thissum
compute allsum=allsum+thissum
end dofor s
compute allsum=0.0
dofor s = %slike("sharedk*")
sstats / s{0}>>thissum
compute allsum=allsum+thissum
end dofor s
Re: Creating sums of series
Almost.
That yields a sum for all the years.
What I'm trying to do is to create a series of sums for every year.
That yields a sum for all the years.
What I'm trying to do is to create a series of sums for every year.
Re: Creating sums of series
That would be
set allsum = 0.0
dofor s = %slike("sharedk*")
set allsum = allsum+s{0}
end dofor s
set allsum = 0.0
dofor s = %slike("sharedk*")
set allsum = allsum+s{0}
end dofor s
Re: Creating sums of series
Yes it would.
thanx
thanx