Page 1 of 1

Combine @sumsby with sample command

Posted: Wed Mar 27, 2019 8:23 am
by chris_cl
Is it possible to combine the @sumsby command with the sample command? I wish to sum over a subgroups in one period in a panel-data set.

Re: Combine @sumsby with sample command

Posted: Wed Mar 27, 2019 8:26 am
by EViews Gareth
Yes, the third argument of the command takes a sample.
http://www.eviews.com/help/helpintro.ht ... stics.html

Re: Combine @sumsby with sample command

Posted: Wed Mar 27, 2019 9:19 am
by chris_cl
That is not exactly what I need.

I have a state-skill combination as the cross-sectional dimension. Now I wish to sum up the values of a series for some of the skills in one state at one point in time.

Re: Combine @sumsby with sample command

Posted: Wed Mar 27, 2019 9:38 am
by EViews Gareth
Not entirely sure I follow, but don't you just want the @sum rather than @sumsby?

Code: Select all

scalar mysum = @sum(myseries, "1990m1 1990m1 if state-skill="CA fishing")

Re: Combine @sumsby with sample command

Posted: Wed Mar 27, 2019 9:45 am
by chris_cl
I need to create a new series that sums up several observations at every point in time. In your example, that would be something like:
series SUM = CA_fishing + CA_hunting but other skills in CA (e.g. CA_farming) must not be included in the summation.

The series SUM then contains the same value for every skill in California.

This summations needs to be computed for each period, i.e. something like @obsid

Re: Combine @sumsby with sample command

Posted: Wed Mar 27, 2019 9:51 am
by EViews Gareth

Code: Select all

series mysum = @sumsby(myseries, @obsid, if skill="fishing")


Perhaps providing a concrete example would help?

Re: Combine @sumsby with sample command

Posted: Thu Mar 28, 2019 2:32 am
by chris_cl
The problem with your suggestion is that it sums up the values if skill=fishing over all states. What I need is that fishing and hunting are summed up in one state.

I solved the issue with a loop. However, it would be interesting to know if it was necessary.