Hi. My dataset is panel data organized from year 2010 to 2015. However, some of the data from 2015 is subject to low quality due various reasons. However, I am able to fix/correct some of the problems myself with the help of you guys, hopefully.
The data is organized by
Some of the variables have no observations in 2015, but some of my data have not changed over the given timeperiod. For instance, a company which is in the health sector is unlikely to suddenly have changed sector to manufacturing, this is an assumption I have to make. Based on this reasoning, I want to give the variable SICCODE the same value in 2015 as in 2014(or 2013 for that matter, but 2014 is enough). So the values for company x is equal to each other in 2014 and 2015.
I have tried with the command.
I`m not sure how to go about it other than using the replace command. But there must be one way I just could say that SICCODE in year 2014 for company Y = SICCODE in year 2015 for company Y. Have anyone been involved in something similar? It should be an easy command, but I have used some hours now without getting any way.
Best regards, Rune.
The data is organized by
Code:
sort company year
Code:
xtset company year
I have tried with the command.
Code:
gen SICCODEDUMMY =
Code:
replace SICCODEDUMMY=1 if year==2012 & SICCODE==1
Code:
replace SICCODEDUMMY=1 in year==2015 if BIG4==1 in year==2014
Best regards, Rune.
Comment