Hello!
For my thesis I want to test a specific hypothesis that requires me to generate a variable UNDERPERFORMING if a certain company (GVKEY) underperformed in a certain year (YEAR)
My data is in a panel data structure, and every company (for every company there is a unique company ID: GVKEY) belongs to a Standard Industry Classification category (SIC). This SIC code exists out of 2 digits (ranging from 20 to 39).
I wanted to know whether there is a quick way to generate a dummy variable that equals "1" if
- a certain company belongs to the bottom 25% companies (relative to the SIC median) based on a profit margin measure (EBIT)
- only for that year
- within a SIC category
For example: company 1932, SIC=21, YEAR=2010, EBIT=5%
--> in the UNDERPERFORMING column, the value should equal 1 if for that year, in SIC=21, that 5% falls in the lowest 25% of all firms in SIC=21, for 2010
And that for every observation, of course.
Right now, I only would know how to do everything manually and that would cost me a lot of time.
I know it is very complicated, I would be very grateful if someone were to be able to help me!
Related Posts with Median per group for every year (panel data)
Is it possible to add _ to the variable used in by() when collapsing to simplify ability to perform search for said variablesUpdate: Title should refer to -reshape- not -collapse- I've performed a collapse to obtain a number…
Difference-in-means tests for the propensity-matched sampleIs there an efficient way in Stata to report the results of difference in means tests on propensity …
xtpcse and xtgls with fixed effectsHello community: I want to robustly estimate (xtgls) a panel data model, for both FE and RE. The fol…
3 plots gathered in 1 subplotHi, I am struggling to gather 3 plots in 1 unique figure with 3 subplots. I want the subplots to de…
Problem with summing using CollapseHi - I'm having a problem with the Collapse command when I try to obtain the sum of variables. My da…
Subscribe to:
Post Comments (Atom)
0 Response to Median per group for every year (panel data)
Post a Comment