new variable with sum of values

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

rbriceno
Posts: 15
Joined: Wed Dec 08, 2010 1:46 pm

new variable with sum of values

Postby rbriceno » Tue Mar 04, 2014 2:48 pm

Dear Eviews users. I'm using Eviews 7.0. I have a panel data with 94 cross sections with information collected for each of 19 days. One of the key variables of the study could have zeros, one or several days. In order to identify the occurrence of values different from zero I made a new variable "X" with assign a value of one if the value of the key variable is different from zero and a zero otherwise.What I need now is to create a new variable "Y" that contains the sum of ones from "X". So for example my id 1 has only one value different from zero and then "Y" should have 19 values of 1, my id2 has three different values and "Y" should have 19 values of 3, and so on.
Any help will be appreciated in order to generate "Y".

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

Re: new variable with sum of values

Postby EViews Gareth » Tue Mar 04, 2014 3:05 pm

Code: Select all

series y = @sumsby(x, @crossid)
Follow us on Twitter @IHSEViews

rbriceno
Posts: 15
Joined: Wed Dec 08, 2010 1:46 pm

Re: new variable with sum of values

Postby rbriceno » Tue Mar 04, 2014 3:09 pm

thanks! Gareth where can I find a list of such useful commands like @sumsby?

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

Re: new variable with sum of values

Postby EViews Gareth » Tue Mar 04, 2014 3:14 pm

By-Group Statistics section of Chapter 13 of the Command Reference.
Follow us on Twitter @IHSEViews


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 4 guests