Announcement

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

  • Creating ranks in panel data

    Dear Members,

    I am quiet new to Stata and need your help regarding a problem:

    I have panel data and for every time period I want to create a new variable, which is the average of a rank of the observations in t-4/-8/-12/-16/-20 on an existing variable for the time periods t-4 to t-23.
    I think I am able to compute the average of the ranks in t-4/-8/-12/-16/-20 with the L. function, but I struggle creating the rank itself, because each observation has various ranks since it appears in several time periods of t-4 to t-23.

    I hope you get my problem.
    Thanks in advance for all answers.

    Best regards,
    Tom Engel

  • #2
    You didn't get a quick answer. You'll increase your chances of a useful reply by following the FAQ on asking questions - provide Stata code in code delimiters, Stata output, and sample data using dataex.

    You can easily create lags using generate. Then you can create ranks using egen with a by modifier. You can move those around with L. or F. operators as well.

    Comment

    Working...
    X