Hello,

I am using Stata 16.1 and I have the following data:

gvkey fyear pifo

007435 2015 2424

007435 2016 2687

007435 2017 3399

007435 2018 3513

007435 2019 2704

007435 2020 2991

001078 2017 1923

001078 2018 3303

001078 2019 3188

001078 2020 3380

016101 2015 .

016101 2016 .

An event occurred in 2017.

I want to make a dummy variable which gives 1 for firms that have a value for PIFO (so not zero or .) and at least one value before the event (can be in 2015 or 2016) and at least one value after the event (can be 2018, 2019 or 2020).

The dummy should give 0 for firms with zero or . for PIFO and for firms without at least one value before and one value after the event date.


Any suggestion is appreciated.

Kind regards,
Sacha