Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with creating subgroups based on age variable

    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

  • #2
    Well, it is an unavoidable fact that as time passes, everything that survives gets older. So no matter how you do this, you are going to see a preponderance of "old" in the lat years and a preponderance of "young" in the early era. There is no way around that. Can you explain more clearly what you are hoping to see?

    Comment


    • #3
      Thanks for the reply Clyde,
      I am looking to separate the biggest and smallest firms in every cross-section of my data. A colleague suggested that I can multiply the age by a big number like 1000000 to decrease the effect of time passing in part, however it's not the best possible way in my view.

      Comment


      • #4
        No, multiplying the age by 1000000, or anything else, will not solve the problem: you'll get exactly the same results.

        So, if I understand correctly, what you want to do is, separately in each year, identify the oldest and youngest (or is it biggest and smallest?) firms in 3 equal groups.

        Code:
        capture program drop one_year
        program define one_year
            egen SMB = cut(age), group(3)
            exit
        end
        
        runby one_year, by(year)
        To use this code, you must install the -runby- command, written by Robert Picard and me, and available from SSC. It gets around the fact that -egen, cut()- does not allow -by-.

        Comment


        • #5
          This is exactly what I was looking for. Thanks again.

          Comment

          Working...
          X