Announcement

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

  • how to use the value of variable A in last year for variable B in this year

    Hi everyone,

    I would ike to create a new variable whose value equals to the value of another variable in last year. How can I achieve this? For example, I have several companies in the dataset and each company has quarterly earnings data from year 2000-2019. I would like to make Earnings 2019,Q1 of company A= Earnings 2018,Q1 of company A, Earnings 2019,Q2 of company A= Earnings 2018,Q2 of company A and so on.

    I am new here, sorry for my poor description. Thank you in advance.

  • #2
    So, you know this is a poor description! https://www.statalist.org/forums/help#stata explains how to do better and specifically how to give a data example. Otherwise

    Code:
    tsset company qdate 
    gen wanted = L4.earnings
    is a wild guess at what you seek.

    Comment

    Working...
    X