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
Creating variable based on conditions of two variables using matrixDear everyone I'm trying to create a variable based on matrix conditions of two other variable. I …
Assigning one of two fixed values to each observation according to categories alongside continuous variablesI have a 16,000 data set with continuous dependant variables and an independent variable. I also hav…
The ouput of logistic regressions in a table (using outreg2, estout, asdoc, ...)Dear All, After running logistic regressions, how can I export the results, in terms of (1) coeffici…
Propensity Score Matching to estimate racial discriminationHello everyone, I am doing research on racial discrimination at the loan approval decisions, i.e. w…
Need Help: Propensity Score Matching Nonnegative integersHi guys, really need help if possible! I'm new to Stata and currently doing my dissertation/thesis …
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