mardi 11 juin 2019

How can I create a new variable that contains the change of a (dummy) variable over time in stata

I have firm level data for 3 years (2015,2016 and 2017). I need to know which firms have a change in a dummy variable (ModelJaarrekening) from year 2016 to year 2017 (a dummy that determines if the firm is large (value 2) or small (value 1).

In other words: I need to select the firms that have a value for ModelJaarrekening of 2 in year 2015 and 2016 but has the value 1 in year 2017.

Following command does not work, I think because it first executes the first command and deletes the other observations.

How can I solve this?

Thanks

gen dummy=1 if (ModelJaarrekening ==2 & year<2017 & ModelJaarrekening ==1 & year==2017)

Aucun commentaire:

Enregistrer un commentaire