Page 1 of 1

Panel Data Conversion

Posted: Fri Apr 01, 2011 6:46 pm
by hfwill
I have a 3-D panel dataset--2 cross sections, 1 time dimension. I want to create a 2-D panel dataset by aggregating (either summing or averaging) across one cross section within another. Is there some way of doing this?

Re: Panel Data Conversion

Posted: Fri Apr 01, 2011 7:48 pm
by EViews Gareth
Create a series containing the amalgamated cross-section id (something like alpha crossid = crossid1 + crossid2). Then create a new page with the same time series and cross-section ID. Then copy from the first page to the second page, doing a general match merge, using your dateid and your cross-id as the source and destination IDs. Then choose the type of contraction, and you're done.

Re: Panel Data Conversion

Posted: Wed May 11, 2011 1:03 pm
by BBuser1
I'm looking to do something similar but want to condition the aggregation. Any suggestions?

Re: Panel Data Conversion

Posted: Wed May 11, 2011 1:23 pm
by EViews Gareth
What does "condition the aggregation" mean?

Re: Panel Data Conversion

Posted: Wed May 11, 2011 1:41 pm
by BBuser1
sorry, i want get a subset of the panel data - average one element for all the cross-sections that meet a certain criteria of a second element. For example, I have 100 people in a survey and i want to find the average income (one element) for men vs women (gender is the second element in the panel).

Re: Panel Data Conversion

Posted: Wed May 11, 2011 1:49 pm
by EViews Gareth
Do you want the average across all cross-sections, or do you want a per-cross-section average?

Re: Panel Data Conversion

Posted: Wed May 11, 2011 1:57 pm
by BBuser1
per cross section, I think. (I'm experienced with time series but this is my first attempt at panels). Right now each panel is 2 dimensions (100 people by 10 survey questions) and I have a separate panel for each time period.The survey is done monthly so I guess I could do 3 dimensions in one big panel? I'm interested in seeing results mothly.

Re: Panel Data Conversion

Posted: Wed May 11, 2011 2:02 pm
by EViews Gareth
I'm still not quite sure I understand what you want. But it sounds like you're simply trying to do something like:

Code: Select all

smpl if gender="male" series mean = @meansby(income, @crossid)
where you replace gender with the name of the series containing gender information, and income with the name of the series containing income information.

Re: Panel Data Conversion

Posted: Wed May 11, 2011 2:10 pm
by BBuser1
It probably is that simple...again, my first attempt at panels. Thanks for the help!

Re: Panel Data Conversion

Posted: Fri May 13, 2011 7:54 am
by BBuser1
Suppose I want to do one calc if gender is male and a different calc if gender is female?

Re: Panel Data Conversion

Posted: Fri May 13, 2011 8:32 am
by EViews Gareth

Code: Select all

smpl if gender="male" series meanmale = @meansby(income, @crossid) smpl if gender="female" series meanfemale = @meansby(income, @crossid)

Re: Panel Data Conversion

Posted: Fri May 13, 2011 8:34 am
by BBuser1
but what if i want just one series "MEAN" rather than meanmale and meanfemale?

Re: Panel Data Conversion

Posted: Fri May 13, 2011 8:38 am
by EViews Gareth

Code: Select all

smpl if gender="male" series mean= @meansby(income, @crossid) smpl if gender="female" series mean = @meansby(income, @crossid)

Re: Panel Data Conversion

Posted: Fri May 13, 2011 8:44 am
by BBuser1
when i do that, the numbers calculated by the first meansby are over written with NAs by the second meansby. In other words, after the first meansby, mean will have numbers for MALE cross sections and NAs for Female. After the second meansby the FEMALE cross sections have numbers but the MALE numbers have been over written by NAs. I have two separate means now, is there a way to combine them (i tried just adding but then they all become NAs) or some other method or am I just doing something wrong?
Thanks.

Re: Panel Data Conversion

Posted: Fri May 13, 2011 8:51 am
by BBuser1
i figured it out. thanks.