Creating an industry median variable

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

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

gerrard
Posts: 17
Joined: Sun Mar 02, 2014 5:38 am

Creating an industry median variable

Postby gerrard » Wed May 14, 2014 4:23 am

Hi,

I have a panel in which I want to generate a new series.
I have firm IDs as cross-sections, the panel is dated annualy.
The panel looks appx. like this (of course more observations and years in the actual panel):

ID YEAR INDUSTRY LEVERAGE MEDIAN LEVERAGE
1 2010 63 0.5 0.4
1 2011 63 0.6 0.5
2 2010 55 0.4 0.3
2 2011 55 0.3 0.3
3 2010 63 0.3 0.4
3 2011 63 0.3 0.5
... ... ... ... ...

What I want is a new series that shows the median leverage of a certain industry for each year.
For example, the median leverage in industry 63 in year 2010 could be 0.4. Then I each cross-section of industry 63 in year 2010 to be assigned this value in the MEDIAN LEVERAGE series.

How do I do that?

Thanks!

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

Re: Creating an industry median variable

Postby startz » Wed May 14, 2014 7:04 am

Code: Select all

series med = @mediansby(LEVERAGE ,@expand(industry,year))
might work. It's worth a try.

gerrard
Posts: 17
Joined: Sun Mar 02, 2014 5:38 am

Re: Creating an industry median variable

Postby gerrard » Thu Jun 05, 2014 7:54 am

Hey,

thanks for your suggestion. Unfortunately, this doesn't work. What the command does is create the median leverage for industry with the code 1 and for year 2000.
I need the median for each industry, for each year.

The variable that the median should be taken of: LEV1
Name of the year variable: YEAR
Name of the industry variable: IND1

Anyone? Would be very grateful.

Thanks!

EDIT: I found out how to do it. It works if you enter

Code: Select all

med_lev1=@mediansby(lev1,ind1,year)
Last edited by gerrard on Thu Jun 05, 2014 8:52 am, edited 1 time in total.

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

Re: Creating an industry median variable

Postby EViews Gareth » Thu Jun 05, 2014 8:16 am

Code: Select all

series med = @mediansby(lev1, ind1, year)


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests