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
Regression with Indicator Function splitting Independent Variable into 2 SubgroupsHi All, I'm working on trying to get the results from the following regression which is a formula u…
Stata/MP 16.1 Processing SpeedHi, I am posting this to get some clarification on the time it takes Stata/MP 16.1 to run code. I wa…
Generating decile portfolio'sDear Statalist, I would like to ask for help regarding a question I've been pondering. I am replica…
Using runiformint(a,b) - Create each Value between a and b once?Hello everybody, I am currently looking for a solution for the creation of random integer values wh…
Trying to make a plot with median and CIHi, I would like to create a plot that shows the median of a variable within two different groups w…
Subscribe to:
Post Comments (Atom)
0 Response to Problem with creating subgroups based on age variable
Post a Comment