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
Related Posts with Generate dummy if last observation for an individual in panel occurs before time x
Plotting a variable within CII have the data below of the Variable X of cities within the UK. How can i plot it within the Upper …
Calculating Rolling Statistics for Panel Data With a Varying Window of ObservationHello Statalist, I would like to create some code which can calculate various statistics (moving a…
PVAR vs. Arellano-Bond estimationHello all, I understand that both PVAR and Arellano-Bond estimation are dynamic panel methods, and …
How to test Interaction in Logistic Regression with categorical independent variables (1 is dummy, other one has 4 categories)?I am trying to test for interaction effect in my logistic model where outcome is dummy and the two i…
Looping over subroutines - Break errorHi, I am trying to loop over subroutines but I am getting a break error before entering any of the …
Subscribe to:
Post Comments (Atom)
0 Response to Generate dummy if last observation for an individual in panel occurs before time x
Post a Comment