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!
Creating an industry median variable
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
-
startz
- Non-normality and collinearity are NOT problems!
- Posts: 3796
- Joined: Wed Sep 17, 2008 2:25 pm
Re: Creating an industry median variable
Code: Select all
series med = @mediansby(LEVERAGE ,@expand(industry,year))
Re: Creating an industry median variable
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
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
Code: Select all
series med = @mediansby(lev1, ind1, year)
Who is online
Users browsing this forum: No registered users and 2 guests
