Dear all,

I have a panel data and would like to create a dummy variable using the following:
bys bvd_id: egen filter=max(X>16 & year==2018); however, if the observation of X in 2018 is missing (.), then egen also generates 1, instead of 0. How can I treat that missing value as zero? I tried the following:

bys bvd_id: egen filter=max(missing(X>16 & year==2018)); This slightly works, but now if I have a missing value for year other than 2018, then the result is also 0.

Really appreciate your help.


Best,

Abdan