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)
Spatial regression results sensitive to normalization of weighting matrixHi Statalist, I’m new to spatial regression and am using the xsmle command to regress sex ratios at…
tagging different groups when the number of observations is a multiple of threeHello, I want to create a variable juridiction that identifies uniquely each juridiction. I have a m…
First Diffrence and Lag of First Difference RegressionHello, I have a short question. If I apply a fixed effect regression with either first difference (…
Using SMCL in Stata GraphsIs there comprehensive documentation of which SMCL tags do and do not work as intended when producin…
mi xtset errors not correctingHi, I am attempting to draw a map with this data. However, each time, I get the error below, even af…
Subscribe to:
Post Comments (Atom)
0 Response to Median per group for every year (panel data)
Post a Comment