Hello,

I have a panel of banks from year 1905 to 1910. Some banks have observations for the whole duration of the panel, some fail before the end of the panel (i.e. last observation in year 1907), some are founded after the beginning of the panel (i.e. first observation in 1906).

Each bank has a unique Id. My time measure is years.

I want to create a dummy variable called "disappear" - if a bank disappears before the end of the panel.

The code I have so far is:

gen disap = 0
sort Id_Bank Year
bys Id_Bank (Year): replace disap = 1 if & Year[_N]<1910

But I am not sure this does what I want - is this the correct way of creating the dummy?

A separate question: what if I wanted to *not* include banks that are founded after 1907, even if they fail before 1910? what code should I use in that case?

Thank you very much for your help.


Beatrice