I have a panel data of companies and their ages and returns for a period of 20 years. as a control for my analyses, I would like to divide the sample into three categories of Old, Medium, and Young in every given date.
I tried :
egen SMB= cut(age),group(3),
however, obviously it doesn't work because the age is changing with time and therefore most of the observations in the later years of the sample will have SMB=3. I was hoping someone could help me with a way to do the same for every given date.
I tried:
by DATE egen SMB= cut(age),group(3)
but "egen cut() may not be combined with by" is the error I receive.
Thanks in advance.
Hamidreza
Related Posts with Problem with creating subgroups based on age variable
How to select/specify variables to include in a table with descriptive statistics?Dear Stata Users, I run the following code to generate a table: Code: unab stubs : *_X local st…
For each i, calculate median value of observations in the dataset whose value falls within an interval defined by i's valueHello! I have 430 observations, each of whom declare a GOAL time (in seconds), and whose FINISH tim…
Collinearity with long-run averageHi, I am creating a long-run average of crime rates disaggregated which are reported at the distric…
replacing missing with non-missing within the same variableBelow is an example of the dataset (for some reason the columns are not lining up with the variables…
Errors using random slope on dummy variableHello, Thank you for reading my post. I am seeking advice about the following problem: I am estimat…
Subscribe to:
Post Comments (Atom)
0 Response to Problem with creating subgroups based on age variable
Post a Comment