Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: Fixing the value in egen command


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Fixing the value in egen command
Date   Wed, 11 Feb 2009 20:54:54 -0000

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 
[email protected] 

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index