Combine @sumsby with sample command

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator

chris_cl
Posts: 9
Joined: Tue Nov 27, 2018 2:18 am

Combine @sumsby with sample command

Postby chris_cl » Wed Mar 27, 2019 8:23 am

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.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13317
Joined: Tue Sep 16, 2008 5:38 pm

Re: Combine @sumsby with sample command

Postby EViews Gareth » Wed Mar 27, 2019 8:26 am

Yes, the third argument of the command takes a sample.
http://www.eviews.com/help/helpintro.ht ... stics.html
Follow us on Twitter @IHSEViews

chris_cl
Posts: 9
Joined: Tue Nov 27, 2018 2:18 am

Re: Combine @sumsby with sample command

Postby chris_cl » Wed Mar 27, 2019 9:19 am

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.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13317
Joined: Tue Sep 16, 2008 5:38 pm

Re: Combine @sumsby with sample command

Postby EViews Gareth » Wed Mar 27, 2019 9:38 am

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")
Follow us on Twitter @IHSEViews

chris_cl
Posts: 9
Joined: Tue Nov 27, 2018 2:18 am

Re: Combine @sumsby with sample command

Postby chris_cl » Wed Mar 27, 2019 9:45 am

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

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13317
Joined: Tue Sep 16, 2008 5:38 pm

Re: Combine @sumsby with sample command

Postby EViews Gareth » Wed Mar 27, 2019 9:51 am

Code: Select all

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


Perhaps providing a concrete example would help?
Follow us on Twitter @IHSEViews

chris_cl
Posts: 9
Joined: Tue Nov 27, 2018 2:18 am

Re: Combine @sumsby with sample command

Postby chris_cl » Thu Mar 28, 2019 2:32 am

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.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 24 guests