gen bad = missing(assets)
bysort bank (bad year) : gen first = assets[1]
Alternatively, a -first()- -egen- function is included in -egenmore- on
SSC that gives first non-missing values.
It's better to learn the logic behind the code above. Within banks, sort
all the missing values to the end and within blocks of non-missing and
missing, sort by year.
Nick
n.j.cox@durham.ac.uk
Tanveer Shehzad
<edited>
I have something like 10,000 banks and I need to
take their initial level of assets (the first available value and not
corresponding to a fixed year). Could there be any solution?
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/