Announcement

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

  • how to replace missing value by using the information in previous or following year?

    I am dealing with panel data of 140,000 firms for period 2010-2015. I found the identity of some firms (e.g. industrial code) are missing in particular year. I would like to replace missing identity by the information from the previous year or from the following year. I did the following command:
    Code:
    list firmcode if indcode==.
    from this command, I can get list of firmcode whose industrial code is missing. I got more than 100 firms. Then, in order to check and edit I did the following command:
    Code:
    edit year firmcode indcode if firmcode==44|firmcode==45|firmcode==46
    I need to repeat the second command many times until I finish editing more than 100 firms.

    If you have a more efficient command, would you please share with me?

    I have to check and edit the missing value of other variables too with the same procedure. I will appreciate your help.

    Best regard,
    Aisah
    Last edited by Aisah Aisah; 25 Mar 2019, 10:07.

  • #2
    This sounds pertinent

    FAQ . . . . . . . . . . . . . . . . . . . . . . . Replacing missing values

    1/12 How can I replace missing values with previous or
    following nonmissing values or within sequences?

    https://www.stata.com/support/faqs/d...issing-values/

    Comment


    • #3
      Thank you very much for your prompt response. The explanation is very helpful.

      Comment

      Working...
      X