How to create series that sums other series for particular date?

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

shunkar
Posts: 6
Joined: Sat Aug 08, 2020 6:45 am

How to create series that sums other series for particular date?

Postby shunkar » Sun Aug 16, 2020 4:42 am

Hello,
I am trying to create my own stock market index that is aggregate of all stocks' trade data within a particular stock market. I have multiple markets with multiple stocks in each. Let's say I want to create a series that sums number of all traded stocks (volume) for each trading day. How can I do it in eviews v8.1?

Assume that for market="US" I have series VOL (number of stocks traded for a given day) for stocks X,Y, and Z for dates Date:t, Date:t+1, and Date:t+n.
I need to create a series of US_inx_vol that sums VOL of all stocks for each date (total number of stocks traded for a given day).

If I use excel SUMIF function then I would type =sumif(range of multiple stocks data for a period; Date; VOL) near each Date on the vector.

PS: Also, if it won't complicate it much, how to weight each additional component. In the example above, all stocks have same impact on the index. Is it possible to weight variables by market capitalization before summing? Let's say I want to estimate weighted average of PE ratio for all stocks in a market.

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: How to create series that sums other series for particular date?

Postby startz » Sun Aug 16, 2020 6:22 am

Code: Select all

series US_inx_vol= volx + voly + volz

series US_inx_vol = .4*volx + .3*boly + .3*volz

shunkar
Posts: 6
Joined: Sat Aug 08, 2020 6:45 am

Re: How to create series that sums other series for particular date?

Postby shunkar » Mon Aug 17, 2020 8:43 pm

Thank you for such swift reply. Although it is helpful as it clearifies that dates are automatically matched, it is not exactly what I was asking. I have over three thousands stocks in each market and I have dozen markets. It will be very difficult to type one by one each stock in the formula. How can I use SUMIF function for stocks from the same market. Something like: if market="US" then sum VOL. Same for other markets.

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

Re: How to create series that sums other series for particular date?

Postby EViews Gareth » Mon Aug 17, 2020 8:52 pm

Code: Select all

series mysum = @sumsby(vol, market)
Follow us on Twitter @IHSEViews

shunkar
Posts: 6
Joined: Sat Aug 08, 2020 6:45 am

Re: How to create series that sums other series for particular date?

Postby shunkar » Sat Sep 05, 2020 3:42 am

Thank you. That's what I was looking for.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 11 guests